2016-11-20 02:50:49 -05:00
|
|
|
/** Custom main() for Criterion
|
|
|
|
*
|
|
|
|
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
2017-04-27 13:08:17 +02:00
|
|
|
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
|
|
|
|
* @license GNU General Public License (version 3)
|
|
|
|
*
|
|
|
|
* VILLASnode
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* any later version.
|
2017-05-05 19:24:16 +00:00
|
|
|
*
|
2017-04-27 13:08:17 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2017-05-05 19:24:16 +00:00
|
|
|
*
|
2017-04-27 13:08:17 +02:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2016-11-20 02:50:49 -05:00
|
|
|
*********************************************************************************/
|
|
|
|
|
|
|
|
#include <criterion/criterion.h>
|
2017-04-02 00:14:35 +02:00
|
|
|
#include <criterion/logging.h>
|
2016-11-20 02:50:49 -05:00
|
|
|
|
|
|
|
#include <villas/log.h>
|
|
|
|
#include <villas/memory.h>
|
2018-03-26 12:50:15 +02:00
|
|
|
#include <villas/config.h>
|
2017-03-12 23:16:33 -03:00
|
|
|
|
2017-04-02 00:14:35 +02:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
struct criterion_test_set *tests;
|
2017-03-07 08:05:04 -04:00
|
|
|
struct log log;
|
|
|
|
|
2017-04-02 00:14:35 +02:00
|
|
|
ret = log_init(&log, V, LOG_ALL);
|
2017-08-20 10:48:44 +02:00
|
|
|
if (ret)
|
2017-04-02 00:14:35 +02:00
|
|
|
error("Failed to initialize logging sub-system");
|
2018-03-26 12:50:15 +02:00
|
|
|
|
2018-05-12 18:14:24 +02:00
|
|
|
ret = log_open(&log);
|
2017-08-20 10:48:44 +02:00
|
|
|
if (ret)
|
|
|
|
error("Failed to start logging sub-system");
|
2017-05-05 19:24:16 +00:00
|
|
|
|
2017-04-02 00:14:35 +02:00
|
|
|
ret = memory_init(DEFAULT_NR_HUGEPAGES);
|
2017-08-20 10:48:44 +02:00
|
|
|
if (ret)
|
2017-04-02 00:14:35 +02:00
|
|
|
error("Failed to initialize memory sub-system");
|
2016-11-20 02:50:49 -05:00
|
|
|
|
2017-04-02 00:14:35 +02:00
|
|
|
/* Run criterion tests */
|
|
|
|
tests = criterion_initialize();
|
2017-05-05 19:24:16 +00:00
|
|
|
|
2017-04-02 00:14:35 +02:00
|
|
|
ret = criterion_handle_args(argc, argv, true);
|
|
|
|
if (ret)
|
|
|
|
ret = !criterion_run_all_tests(tests);
|
2016-11-20 02:50:49 -05:00
|
|
|
|
|
|
|
criterion_finalize(tests);
|
2017-04-02 00:14:35 +02:00
|
|
|
|
|
|
|
return ret;
|
2018-03-26 12:50:15 +02:00
|
|
|
}
|