Тааак

This commit is contained in:
AZEN-SGG 2024-12-21 21:21:19 +03:00
parent 8429487f57
commit a354c34e1d

View file

@ -13,45 +13,68 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3
- name: Make `makefile.sh` executable
run: |
chmod +x makefile.sh
- name: Make `makefile.sh` executable
run: |
chmod +x makefile.sh
- name: Run `makefile.sh` to prepare Makefile
run: |
./makefile.sh
if [ $? -ne 0 ]; then
echo "::error::makefile.sh failed"
exit 1
fi
- name: Compile using Makefile
run: |
cd ComputationalGeometry/6Ex
make
if [ $? -ne 0 ]; then
echo "::error::Compilation failed"
exit 1
fi
- name: Run Tests
run: |
cd ComputationalGeometry/6Ex
if [ ! -f "./a.out" ]; then
echo "::error::Executable not found: a.out"
exit 1
fi
for file in t/*; do
echo "Testing with file: $file"
# Передаём последовательный ввод
printf "0\n$file\n" | ./a.out
- name: Run `makefile.sh` to prepare Makefile
run: |
./makefile.sh
if [ $? -ne 0 ]; then
echo "::error::Test failed for $file"
echo "::error::makefile.sh failed"
exit 1
fi
done
- name: Compile using Makefile
run: |
cd ComputationalGeometry/6Ex
make
if [ $? -ne 0 ]; then
echo "::error::Compilation failed"
exit 1
fi
- name: Run Tests
run: |
cd ComputationalGeometry/6Ex
if [ ! -f "./a.out" ]; then
echo "::error::Executable not found: a.out"
exit 1
fi
# Проверяем, что есть папка t/ с тестовыми файлами
if [ ! -d "t" ]; then
echo "::error::Directory 't' with test files not found"
exit 1
fi
for file in t/*; do
echo "------------------------------------"
echo "Testing with file: $file"
# Способ 1. Передавать через временный файл
# echo "0" > test_input.txt
# echo "$file" >> test_input.txt
# echo "=== Test input ==="
# cat test_input.txt
# echo "=================="
# ./a.out < test_input.txt
# Способ 2. Через printf (важно экранировать %s и $file)
printf "0\n%s\n" "$file" | ./a.out
# Или можно так (если хотите увидеть ввод на экране лога):
echo -e "0\n$file\n" | ./a.out
status=$?
echo "Exit code: $status"
if [ $status -ne 0 ]; then
echo "::error::Test failed for $file"
exit 1
fi
done
echo "All tests passed successfully."