Merge pull request #7 from BriceBoisson/test-error_message_test_exec_too_low
Add: error message test exec too low
This commit is contained in:
commit
4a91b52975
|
@ -8,6 +8,7 @@ if len(sys.argv) != 2:
|
||||||
source_code = open(sys.argv[1], 'r')
|
source_code = open(sys.argv[1], 'r')
|
||||||
Lines = source_code.readlines()
|
Lines = source_code.readlines()
|
||||||
test_file = []
|
test_file = []
|
||||||
|
nb_test = 0
|
||||||
|
|
||||||
def get_test(test, instr_addr, final = False):
|
def get_test(test, instr_addr, final = False):
|
||||||
result = ""
|
result = ""
|
||||||
|
@ -48,6 +49,7 @@ for line in Lines:
|
||||||
new_test = get_test(test, instr_addr)
|
new_test = get_test(test, instr_addr)
|
||||||
if new_test != "":
|
if new_test != "":
|
||||||
test_file.append(new_test)
|
test_file.append(new_test)
|
||||||
|
nb_test += 1
|
||||||
instr_addr += 4
|
instr_addr += 4
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,6 +69,7 @@ for line in reversed(Lines):
|
||||||
new_test = get_test(test, instr_addr, True)
|
new_test = get_test(test, instr_addr, True)
|
||||||
if new_test != "":
|
if new_test != "":
|
||||||
final_test_file.append(new_test)
|
final_test_file.append(new_test)
|
||||||
|
nb_test += 1
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -74,3 +77,5 @@ for line in reversed(Lines):
|
||||||
with open('final_test.tmp', 'w') as f:
|
with open('final_test.tmp', 'w') as f:
|
||||||
for item in final_test_file:
|
for item in final_test_file:
|
||||||
f.write("%s\n" % item)
|
f.write("%s\n" % item)
|
||||||
|
|
||||||
|
print(f"Generated {nb_test} tests")
|
||||||
|
|
|
@ -32,8 +32,7 @@ run_test ()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
./${SCRIPT_FOLDER}/get_bin.sh $TEST_FILE_PATH
|
./${SCRIPT_FOLDER}/get_bin.sh $TEST_FILE_PATH
|
||||||
python3 ./${SCRIPT_FOLDER}/gen_test.py $TEST_FILE_PATH
|
NB_TEST=$(python3 ./${SCRIPT_FOLDER}/gen_test.py $TEST_FILE_PATH | sed -n 's/^Generated \([[:digit:]]*\) tests$/\1/p')
|
||||||
|
|
||||||
|
|
||||||
if [ -z $2 ]; then
|
if [ -z $2 ]; then
|
||||||
vsim -c -do "do simu.do; quit -f" >& /dev/null
|
vsim -c -do "do simu.do; quit -f" >& /dev/null
|
||||||
|
@ -41,7 +40,7 @@ run_test ()
|
||||||
vsim -do "do simu.do"
|
vsim -do "do simu.do"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print_result "$TEST_BENCH-$(basename $TEST_FILE_PATH .S)"
|
print_result "$TEST_BENCH-$(basename $TEST_FILE_PATH .S)" "$NB_TEST"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_result ()
|
print_result ()
|
||||||
|
@ -71,6 +70,10 @@ print_result ()
|
||||||
fi
|
fi
|
||||||
done < ./transcript
|
done < ./transcript
|
||||||
|
|
||||||
|
if [ ! -z $2 ] && [ $2 -ne 0 ] && [ $nb_test -lt $2 ]; then
|
||||||
|
echo -e "\033[0;31m$BOLD"Warning:"$NORMAL\033[0m Only $BOLD$nb_test$NORMAL tests were executed, at least $BOLD$2$NORMAL were expected."
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "[\033[0;34m$BOLD$1$NORMAL\033[0m]$BOLD Test: $nb_test | Passed: $NORMAL\033[0;32m$BOLD$nb_pass$NORMAL\033[0m$BOLD | Failed: $NORMAL\033[0;31m$BOLD$nb_fail$NORMAL\033[0m"
|
echo -e "[\033[0;34m$BOLD$1$NORMAL\033[0m]$BOLD Test: $nb_test | Passed: $NORMAL\033[0;32m$BOLD$nb_pass$NORMAL\033[0m$BOLD | Failed: $NORMAL\033[0;31m$BOLD$nb_fail$NORMAL\033[0m"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue