From b9f2344981bb93c2284398d02b9fcac12eed5c85 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Sun, 2 Oct 2022 19:18:57 +0200 Subject: [PATCH] fixes ordered_semaphore test --- src/sc_main.cpp | 7 +------ tests/axi4_pin_level/narrow_burst_test.cpp | 3 +++ tests/ordered_semaphore/test.cpp | 9 ++++++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/sc_main.cpp b/src/sc_main.cpp index 9da8eee..7f7ca07 100644 --- a/src/sc_main.cpp +++ b/src/sc_main.cpp @@ -20,17 +20,12 @@ int sc_main(int argc, char* argv[]) { auto my_name = util::split(argv[0], '/').back(); scc::init_logging(LogConfig().logLevel(getenv("SCC_TEST_VERBOSE")?log::DEBUG:log::INFO).logAsync(false)); // create tracer - //auto trc = scc::create_fst_trace_file(my_name.c_str()); - //auto trc = scc::create_vcd_pull_trace_file(my_name.c_str()); scc::tracer trace(my_name, scc::tracer::file_type::TEXT, true); // instantiate design(s) factory::get_instance().create(); // run tests int result = Catch::Session().run( argc, argv ); - // close trace file - //scc::close_fst_trace_file(trc); - //scc::close_vcd_pull_trace_file(trc); // destroy design(s) factory::get_instance().destroy(); - return result + sc_report_handler::get_count(SC_ERROR) + sc_report_handler::get_count(SC_WARNING); + return result; } diff --git a/tests/axi4_pin_level/narrow_burst_test.cpp b/tests/axi4_pin_level/narrow_burst_test.cpp index 316db58..14282c1 100644 --- a/tests/axi4_pin_level/narrow_burst_test.cpp +++ b/tests/axi4_pin_level/narrow_burst_test.cpp @@ -160,6 +160,9 @@ TEST_CASE("pin level narrow burst", "[AXI][pin-level]") { run_scenario(state); + REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); + REQUIRE(sc_report_handler::get_count(SC_WARNING) == 0); + REQUIRE(state.resp_cnt==4*state.NumberOfIterations); for(auto& e: state.write_tx) { auto const& send_tx = e.second.first; diff --git a/tests/ordered_semaphore/test.cpp b/tests/ordered_semaphore/test.cpp index 9cccd2c..0f59a3d 100644 --- a/tests/ordered_semaphore/test.cpp +++ b/tests/ordered_semaphore/test.cpp @@ -7,8 +7,9 @@ using namespace sc_core; -class top: public sc_core::sc_module { -public: +struct top: public sc_core::sc_module { + top():top("top"){} + top(sc_module_name const& nm):sc_core::sc_module(nm) {} scc::ordered_semaphore sem{"sem", 2}; scc::ordered_semaphore_t<2> sem_t{"sem_t"}; }; @@ -22,11 +23,13 @@ TEST_CASE("simple ordered_semaphore test", "[SCC][ordered_semaphore]") { dut.sem.wait(); dut.sem_t.wait(); dut.sem.set_capacity(4); - dut.sem_t.set_capacity(4); + dut.sem_t.set_capacity(4); // should fail dut.sem_t.post(); dut.sem.post(); }); sc_start(1_ns); REQUIRE(run1.terminated()); + REQUIRE(sc_report_handler::get_count(SC_ERROR) == 0); + REQUIRE(sc_report_handler::get_count(SC_WARNING) == 1); }