SystemC-Components-Test/src/sc_main.cpp

35 lines
956 B
C++
Raw Permalink Normal View History

/*
* sc_main.cpp
*
* Created on:
* Author:
*/
#include "factory.h"
#include <catch2/catch_session.hpp>
2023-12-22 20:42:21 +01:00
#include <cstdlib>
2022-10-02 11:39:06 +02:00
#include <scc/report.h>
#include <scc/trace.h>
#include <scc/tracer.h>
#include <util/ities.h>
using namespace scc;
2022-10-02 11:39:06 +02:00
using namespace sc_core;
int sc_main(int argc, char* argv[]) {
2022-10-02 18:20:00 +02:00
auto my_name = util::split(argv[0], '/').back();
2023-12-22 20:42:21 +01:00
scc::init_logging(LogConfig().logLevel(getenv("SCC_TEST_VERBOSE") ? log::DEBUG : log::FATAL).logAsync(false));
// create tracer if environment variable SCC_TEST_TRACE is defined
std::unique_ptr<scc::tracer> tracer;
if(getenv("SCC_TEST_TRACE"))
2023-12-22 20:42:21 +01:00
tracer = std::make_unique<scc::tracer>(my_name, scc::tracer::file_type::TEXT, true);
2022-10-02 18:20:00 +02:00
// instantiate design(s)
factory::get_instance().create();
2022-10-02 18:20:00 +02:00
// run tests
2023-12-22 20:42:21 +01:00
int result = Catch::Session().run(argc, argv);
2022-10-02 18:20:00 +02:00
// destroy design(s)
sc_stop();
factory::get_instance().destroy();
2022-10-02 19:18:57 +02:00
return result;
}