mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 06:03:23 +00:00
tests: Add script tests
Currently provides tests for logging quoted strings.
This commit is contained in:
parent
3dd32d741a
commit
e44d69908b
4 changed files with 40 additions and 0 deletions
1
Makefile
1
Makefile
|
@ -861,6 +861,7 @@ endif
|
||||||
+cd tests/various && bash run-test.sh
|
+cd tests/various && bash run-test.sh
|
||||||
+cd tests/select && bash run-test.sh
|
+cd tests/select && bash run-test.sh
|
||||||
+cd tests/sat && bash run-test.sh
|
+cd tests/sat && bash run-test.sh
|
||||||
|
+cd tests/scripts && bash run-test.sh
|
||||||
+cd tests/sim && bash run-test.sh
|
+cd tests/sim && bash run-test.sh
|
||||||
+cd tests/svinterfaces && bash run-test.sh $(SEEDOPT)
|
+cd tests/svinterfaces && bash run-test.sh $(SEEDOPT)
|
||||||
+cd tests/svtypes && bash run-test.sh $(SEEDOPT)
|
+cd tests/svtypes && bash run-test.sh $(SEEDOPT)
|
||||||
|
|
3
tests/scripts/.gitignore
vendored
Normal file
3
tests/scripts/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
*.err
|
||||||
|
*.log
|
||||||
|
run-test.mk
|
4
tests/scripts/run-test.sh
Executable file
4
tests/scripts/run-test.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eu
|
||||||
|
source ../gen-tests-makefile.sh
|
||||||
|
run_tests --bash
|
32
tests/scripts/test_logging.sh
Executable file
32
tests/scripts/test_logging.sh
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
var=0
|
||||||
|
rm -f quotes-*.log quotes-*.err
|
||||||
|
|
||||||
|
test_log()
|
||||||
|
{
|
||||||
|
# Usage: test_log <log_str> <grep_str>
|
||||||
|
var=$((var + 1))
|
||||||
|
log_str="$1"
|
||||||
|
grep_str="$2"
|
||||||
|
log_file="quotes-$var.log"
|
||||||
|
../../yosys -QTq -l $log_file -p "log $log_str"
|
||||||
|
if ! grep -qx "$grep_str" $log_file; then
|
||||||
|
echo "ERROR: Expected 'yosys> log $log_str' to log '$grep_str'." > "quotes-$var.err"
|
||||||
|
cat "quotes-$var.err"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
test_log "test" "test"
|
||||||
|
test_log "test;" "test"
|
||||||
|
test_log "test;;" "test"
|
||||||
|
test_log "\"test" "\"test"
|
||||||
|
test_log "test\"" "test\""
|
||||||
|
test_log "\"test\"" "test"
|
||||||
|
test_log "\"test;\"" "test;"
|
||||||
|
test_log "\"test;;\"" "test;;"
|
||||||
|
test_log "\"test\" abc" "\"test\" abc"
|
||||||
|
|
||||||
|
if [ -f quotes-*.err ] ; then
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue