Skip to content

Commit

Permalink
tests: Sprinkle cover() over tests, assert they get reached
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Povišer <povik@cutebit.org>
  • Loading branch information
povik committed Jan 5, 2024
1 parent 398cfe4 commit e77727f
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ test: build/fold.so
@for testcase in tests/programs/*.fold tests/programs/*.fold.disabled_mcode; \
do \
echo -n "$${testcase}... "; \
if ! $(YOSYS) -m $(TARGET_PLUGIN_LIB) -m fold.logic.frontend.py -p "read_fold $${testcase}; fold_synth; read_verilog -sv support/mutex_assert.sv; hierarchy -top top; proc; memory_nordff; sim -n 100 -assert -clock clk -reset rst" 1>/dev/null 2>&1; then \
if ! $(YOSYS) -m $(TARGET_PLUGIN_LIB) -m fold.logic.frontend.py -p "read_fold $${testcase}; fold_synth; read_verilog -sv support/mutex_assert.sv; hierarchy -top top; proc; memory_nordff; sim -n 100 -assert -assert-cover -clock clk -reset rst" 1>/dev/null 2>&1; then \
echo -e "\e[31mFAIL\e[0m"; \
echo -e "Testcase \e[1m$${testcase}\e[0m failed"; \
$(YOSYS) -m $(TARGET_PLUGIN_LIB) -m fold.logic.frontend.py -p "read_fold $${testcase}; fold_synth; read_verilog -sv support/mutex_assert.sv; hierarchy -top top; proc; memory_nordff; sim -n 100 -assert -clock clk -reset rst"; \
$(YOSYS) -m $(TARGET_PLUGIN_LIB) -m fold.logic.frontend.py -p "read_fold $${testcase}; fold_synth; read_verilog -sv support/mutex_assert.sv; hierarchy -top top; proc; memory_nordff; sim -n 100 -assert -assert-cover -clock clk -reset rst"; \
echo; \
else \
echo -e "\e[32mOK\e[0m"; \
Expand Down
1 change: 1 addition & 0 deletions tests/programs/chan1.fold.disabled_mcode
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ assert_equal(v, 0x55);
` wait.
v = g->(6);
assert_equal(v, 0);
cover();
1 change: 1 addition & 0 deletions tests/programs/factorial.fold
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ assert_equal(v, 5*4*3*2*1);
` wait.
v = factorial(7);
assert_equal(v, 7*6*5*4*3*2*1);
cover();
1 change: 1 addition & 0 deletions tests/programs/flow1.fold
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ for k != 0x8000 {
}

assert_equal(j, 2 * 15);
cover();
1 change: 1 addition & 0 deletions tests/programs/flow2.fold
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ for N < 9 {
delay(1);
}
assert_equal(ret, expected);
cover();
1 change: 1 addition & 0 deletions tests/programs/flow3.fold
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ for N < 12 {
delay(1);
}
assert_equal(ret2, 40320);
cover();
1 change: 1 addition & 0 deletions tests/programs/flow4.fold
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ for N < 9 {
delay(1);
}
assert_equal(ret, 40320);
cover();
1 change: 1 addition & 0 deletions tests/programs/flow6.fold
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ test(2);
delay(1);
`wait.
test(3);
cover();
2 changes: 2 additions & 0 deletions tests/programs/nestedmem.fold
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,6 @@ func entry()() {
pass(0x3, m[1]);
}

` wait.
entry();
cover();

0 comments on commit e77727f

Please sign in to comment.