Update compile-and-test.yml
This commit is contained in:
parent
a6ecfb510b
commit
74e49f5ae5
1 changed files with 52 additions and 57 deletions
31
.github/workflows/compile-and-test.yml
vendored
31
.github/workflows/compile-and-test.yml
vendored
|
|
@ -17,8 +17,7 @@ jobs:
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Make `makefile.sh` executable
|
- name: Make `makefile.sh` executable
|
||||||
run: |
|
run: chmod +x makefile.sh
|
||||||
chmod +x makefile.sh
|
|
||||||
|
|
||||||
- name: Run `makefile.sh` to prepare Makefile
|
- name: Run `makefile.sh` to prepare Makefile
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -45,32 +44,28 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Проверяем, что папка с тестами есть:
|
||||||
if [ ! -d "t" ]; then
|
if [ ! -d "t" ]; then
|
||||||
echo "::error::Directory 't' with test files not found"
|
echo "::error::No directory 't' with test files"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for file in t/*; do
|
for f in t/*; do
|
||||||
echo "------------------------------------"
|
echo "======================="
|
||||||
echo "Testing with file: $file"
|
echo "Testing with file: $f"
|
||||||
|
|
||||||
# Создаём временный файл с "0" и именем тестового файла:
|
# Создаём файл с вводом
|
||||||
echo "0" > test_input.txt
|
echo "0" > input.txt
|
||||||
echo "$file" >> test_input.txt
|
echo "$f" >> input.txt
|
||||||
|
|
||||||
echo "==== DEBUG test_input.txt ===="
|
echo "DEBUG: cat -A input.txt"
|
||||||
cat -A test_input.txt
|
cat -A input.txt # Посмотреть, нет ли там ^M
|
||||||
echo "=============================="
|
|
||||||
|
|
||||||
# Теперь фидим это stdin
|
./a.out < input.txt
|
||||||
./a.out < test_input.txt
|
|
||||||
status=$?
|
status=$?
|
||||||
echo "Exit code: $status"
|
|
||||||
|
|
||||||
if [ $status -ne 0 ]; then
|
if [ $status -ne 0 ]; then
|
||||||
echo "::error::Test failed for $file"
|
echo "::error::Test failed for $f"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "All tests passed successfully."
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue