Теперь должен заработать
This commit is contained in:
parent
a6ecfb510b
commit
a968c5c6fb
2 changed files with 48 additions and 59 deletions
27
.github/workflows/compile-and-test.yml
vendored
27
.github/workflows/compile-and-test.yml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
||||||
|
|
||||||
- name: Run `makefile.sh` to prepare Makefile
|
- name: Run `makefile.sh` to prepare Makefile
|
||||||
run: |
|
run: |
|
||||||
./makefile.sh
|
./makefile.sh delete
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "::error::makefile.sh failed"
|
echo "::error::makefile.sh failed"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -45,32 +45,13 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "t" ]; then
|
|
||||||
echo "::error::Directory 't' with test files not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
for file in t/*; do
|
for file in t/*; do
|
||||||
echo "------------------------------------"
|
|
||||||
echo "Testing with file: $file"
|
echo "Testing with file: $file"
|
||||||
|
|
||||||
# Создаём временный файл с "0" и именем тестового файла:
|
# Создаём файл ввода
|
||||||
echo "0" > test_input.txt
|
(echo "0"; echo "$file") | ./a.out
|
||||||
echo "$file" >> test_input.txt
|
if [ $? -ne 0 ]; then
|
||||||
|
|
||||||
echo "==== DEBUG test_input.txt ===="
|
|
||||||
cat -A test_input.txt
|
|
||||||
echo "=============================="
|
|
||||||
|
|
||||||
# Теперь фидим это stdin
|
|
||||||
./a.out < test_input.txt
|
|
||||||
status=$?
|
|
||||||
echo "Exit code: $status"
|
|
||||||
|
|
||||||
if [ $status -ne 0 ]; then
|
|
||||||
echo "::error::Test failed for $file"
|
echo "::error::Test failed for $file"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "All tests passed successfully."
|
|
||||||
|
|
|
@ -5,9 +5,17 @@ find . -type f -name "makefile" | while read -r file; do
|
||||||
|
|
||||||
tmp_file=$(mktemp)
|
tmp_file=$(mktemp)
|
||||||
|
|
||||||
|
if [ "$1" == "delete" ]; then
|
||||||
|
# Удаление строк с a.exe
|
||||||
|
sed -e '/a\.exe/d' \
|
||||||
|
-e 's/\<del\>/rm/g' \
|
||||||
|
-e 's/\-lssp//g' "$file" > "$tmp_file"
|
||||||
|
else
|
||||||
|
# Замена a.exe на ./a.out
|
||||||
sed -e 's/a\.exe/\.\/a\.out/g' \
|
sed -e 's/a\.exe/\.\/a\.out/g' \
|
||||||
-e 's/\<del\>/rm/g' \
|
-e 's/\<del\>/rm/g' \
|
||||||
-e 's/\-lssp//g' "$file" > "$tmp_file"
|
-e 's/\-lssp//g' "$file" > "$tmp_file"
|
||||||
|
fi
|
||||||
|
|
||||||
mv "$tmp_file" "$file"
|
mv "$tmp_file" "$file"
|
||||||
echo "File $file processed."
|
echo "File $file processed."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue