Skip to content

Commit

Permalink
Add some initial testing
Browse files Browse the repository at this point in the history
  • Loading branch information
povik committed Jun 12, 2024
1 parent e48d42b commit 3bb0c69
Show file tree
Hide file tree
Showing 6 changed files with 2,152 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build test
name: Build and test
on:
push:
branches: [ "*" ]
Expand Down Expand Up @@ -82,8 +82,14 @@ jobs:
make -C build/slang install
- name: Build yosys-slang
run: |
yosys-config --build slang.so \
yosys-config --build build/slang.so \
slang_frontend.cc initial_eval.cc proc_usage.cc \
-Ibuild/slang_install/include -std=c++20 \
-DSLANG_BOOST_SINGLE_HEADER -Lbuild/slang_install/lib \
-lsvlang -lfmt
- name: Pull submodules for tests
run: |
git submodule update --depth 0 -- tests/third_party/picorv32
- name: Run tests
run: |
tests/run.sh
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "tests/third_party/yosys"]
path = tests/third_party/yosys
url = https://github.com/YosysHQ/yosys.git
[submodule "tests/third_party/picorv32"]
path = tests/third_party/picorv32
url = https://github.com/YosysHQ/picorv32.git
22 changes: 22 additions & 0 deletions tests/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
YOSYS=yosys
TESTSDIR="$(dirname "${BASH_SOURCE[0]}")"
PLUGIN="$(realpath "$TESTSDIR/../build/slang.so")"
code=0
for testcase in "$TESTSDIR"/*/*.ys;
do
TEXT=$testcase;
base=$(basename "$testcase")
dir=$(dirname "$testcase")
echo -n "${TEXT}... ";
if ! (cd "$dir" && exec "$YOSYS" -m "$PLUGIN" -s "$base" 1>/dev/null 2>&1); then
echo -e "\e[31mFAIL\e[0m";
echo -e "Testcase \e[1m${testcase}\e[0m failed";
(cd "$dir" && exec "$YOSYS" -g -Q -m "$PLUGIN" -s "$base");
echo;
code=1;
else
echo -e "\e[32mOK\e[0m";
fi
done;
exit $code
1 change: 1 addition & 0 deletions tests/third_party/picorv32
Submodule picorv32 added at 336cfc
Loading

0 comments on commit 3bb0c69

Please sign in to comment.