Skip to content

Commit

Permalink
temporarily disabled constructor tests in linux CI #264
Browse files Browse the repository at this point in the history
  • Loading branch information
CblPOK-git committed Sep 29, 2023
1 parent b0460b5 commit 9ea08d3
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 6 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ jobs:
run: |
make -C build assign_cpp_examples -j$(nproc)
- name: Build tests
- name: Build tests (constructors tests disabled)
run: |
chmod +x ./tests/build_tests.sh
bash ./tests/build_tests.sh make -j$(nproc)
chmod +x ./tests/build_tests_without_constructors.sh
bash ./tests/build_tests_without_constructors.sh make -j$(nproc)
- name: Run tests
- name: Run tests (constructors tests disabled)
run: |
chmod +x ./tests/run_tests.sh
bash ./tests/run_tests.sh make -j$(nproc)
chmod +x ./tests/run_tests_without_constructors.sh
bash ./tests/run_tests_without_constructors.sh make -j$(nproc)
- name: Build proof for the circuit of the C++ examples
run: |
Expand Down
32 changes: 32 additions & 0 deletions tests/build_tests_without_constructors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
readarray test_examples < tests/tests_list.txt
exit_code=0

if [ $1 != "make" ] && [ $1 != "ninja" ]; then
echo "Got $1 instead of make/ninja"
echo "Build system must be entered as command line argument 1";
exit 1
fi


if [[ $2 =~ ^-j[0-9]+$ ]]; then
for test_example in ${test_examples[*]}; do

if [[ $test_example != *"constructors"* ]]; then
$1 -C build ${test_example////_}_calculate_expected_res $2;
if [ $? -ne 0 ]; then
exit_code=1
fi

$1 -C build ${test_example////_} $2;
if [ $? -ne 0 ]; then
exit_code=1
fi
fi

done
else
echo "Got $2 as command line argument 2, must be number of cpu's"
echo "(linux: -j\$(nproc), mac: : -j\$(sysctl -n hw.logicalcpu))"
fi

exit $exit_code
59 changes: 59 additions & 0 deletions tests/run_tests_without_constructors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
readarray test_examples < tests/tests_list.txt
exit_code=0
at_least_one_test_launched=0

for i in ${!test_examples[*]}; do
test_example=${test_examples[i]//$'\n'/}
parent_dir=$(dirname "$test_example")

if [[ $test_example == *"constructors"* ]]; then
echo -e "\033[31m Constructor tests temporarily disabled. \033[0m";
else

echo ""
echo test_example: $test_example

for file in tests/inputs/$parent_dir/*.inp; do

echo -n "input $file: ";
./build/bin/assigner/assigner -b build/tests/cpp/${test_example////_}.ll -i "$file" -t assignment.tbl -c circuit.crct -e pallas --check --print_circuit_output > real.log
if [ $? -ne 0 ]; then
exit_code=1
echo -e "\033[31m Assigner failed! \033[0m";
continue
fi

./build/tests/cpp/${test_example////_}_calculate_expected_res "$file" > expected.log
if [ $? -ne 0 ]; then
exit_code=1
echo -e "\033[31m Calculation of expected result failed! \033[0m";
continue
fi

diff -u expected.log real.log >diff.log;

if [ $? -eq 0 ]; then
echo -e "\033[32m succeeded \033[0m";
else
exit_code=1
echo -e "\033[31m Test failed! Real result differs from expected result. \033[0m";
echo -e "\nexpected result:";
cat expected.log;
echo -e "\nreal circuit output:";
cat real.log;
echo -e "\ninput:";
cat "$file";
echo -e "\n--------------------------------------------------------------------------------";
fi
at_least_one_test_launched=1
done
fi
done

rm real.log expected.log diff.log

if [ $at_least_one_test_launched -eq 0 ]; then
exit 1
else
exit $exit_code
fi

0 comments on commit 9ea08d3

Please sign in to comment.