Skip to content

Commit

Permalink
Merge branch 'master' into orbit
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed May 1, 2024
2 parents c183116 + 7156e62 commit e9d809e
Show file tree
Hide file tree
Showing 226 changed files with 74 additions and 605,222 deletions.
21 changes: 16 additions & 5 deletions VortexEngine/tests/create_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ TODO=

declare -a REPOS
# Iterate through all the folders that start with "test_" in the current directory
for folder in tests_*/; do
# Remove the "./tests_" prefix and the final slash
for folder in tests_*.tar.gz; do
# Remove the "./tests_" prefix and the extension
folder_name=${folder#tests_}
folder_name=${folder_name%/}
folder_name=${folder_name%.tar.gz}
# Add the folder name to the array
REPOS+=("$folder_name")
done
Expand Down Expand Up @@ -54,6 +54,11 @@ select_repo() {
local original_PS3=$PS3
local repo

if [ "${#REPOS[@]}" -eq 1 ]; then
echo ${REPOS[0]}
return
fi

PS3='Please choose a repository: '

select repo in "${REPOS[@]}"; do
Expand Down Expand Up @@ -99,9 +104,10 @@ if [ -z "$TARGETREPO" ]; then
TARGETREPO=$(select_repo)
fi

TESTDIR=tests_$TARGETREPO
# unzip the tests
tar -xvf tests_$TARGETREPO.tar.gz &> /dev/null

mkdir -p $TESTDIR
TESTDIR=tests_$TARGETREPO

if [ $NOMAKE -eq 0 ]; then
echo -e -n "\e[33mBuilding Vortex...\e[0m"
Expand Down Expand Up @@ -206,6 +212,11 @@ while true; do
# cd back
cd -

# re-zip
tar -zcvf tmp_tests_$TARGETREPO.tar.gz tests_$TARGETREPO &> /dev/null
mv tmp_tests_$TARGETREPO.tar.gz tests_$TARGETREPO.tar.gz
rm -rf tests_$TARGETREPO

# done
echo "Test file created: ${TEST_FILE}"

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions VortexEngine/tests/record_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ fi
INPUT="$(grep "Input=" $FILE | cut -d= -f2)"
BRIEF="$(grep "Brief=" $FILE | cut -d= -f2)"
ARGS="$(grep "Args=" $FILE | cut -d= -f2)"
TESTNUM="$(echo $FILE | cut -d/ -f2 | cut -d_ -f1 | cut -d/ -f2)"
TESTNUM="$(echo $FILE | cut -d/ -f3 | cut -d_ -f1 | cut -d/ -f2)"
TESTNUM=$((10#$TESTNUM))

if [ "$QUIET" -eq 0 ]; then
echo -e -n "\e[31mRecording $PROJECT ($TESTCOUNT/$NUMFILES) \e[33m[\e[97m$BRIEF\e[33m] \e[33m[\e[97m$ARGS\e[33m]...\e[0m"
echo -e -n "\e[31mRecording $FILE ($TESTCOUNT/$NUMFILES) \e[33m[\e[97m$BRIEF\e[33m] \e[33m[\e[97m$ARGS\e[33m]...\e[0m"
fi
TEMP_FILE="tmp/${FILE}.out"
TEMP_FILE="${FILE}.out"
# Append the output of the $VORTEX command to the temp file
# NOTE: When recording the tests we don't use valgrind because
# the valgrind output should be clean anyway. But when running
Expand Down
34 changes: 27 additions & 7 deletions VortexEngine/tests/recordtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ TODO=

declare -a REPOS
# Iterate through all the folders that start with "test_" in the current directory
for folder in tests_*/; do
# Remove the "./tests_" prefix and the final slash
for folder in tests_*.tar.gz; do
# Remove the "./tests_" prefix and the extension
folder_name=${folder#tests_}
folder_name=${folder_name%/}
folder_name=${folder_name%.tar.gz}
# Add the folder name to the array
REPOS+=("$folder_name")
done
Expand Down Expand Up @@ -49,6 +49,11 @@ select_repo() {
local original_PS3=$PS3
local repo

if [ "${#REPOS[@]}" -eq 1 ]; then
echo ${REPOS[0]}
return
fi

PS3='Please choose a repository: '

select repo in "${REPOS[@]}"; do
Expand Down Expand Up @@ -84,19 +89,29 @@ function record_tests() {

FILES=

rm -rf tmp/$PROJECT
mkdir -p tmp/$PROJECT
# clear tmp folder
rm -rf tmp/
mkdir -p tmp/

cp $PROJECT.tar.gz tmp/

# unzip the tests
(cd tmp && tar -xvf $PROJECT.tar.gz &> /dev/null)
if [ $? -ne 0 ]; then
echo "Failed to unzip $PROJECT.tar.gz: $!"
exit 1
fi

if [ "$TODO" != "" ]; then
FILES=$(find $PROJECT -name $(printf "%04d" $TODO)*.test)
FILES=$(find tmp/$PROJECT -name $(printf "%04d" $TODO)*.test)
if [ "$FILES" == "" ]; then
echo "Could not find test $TODO"
exit
fi
NUMFILES=1
else
# Iterate through the test files
for file in "$PROJECT"/*.test; do
for file in tmp/$PROJECT/*.test; do
# Check if the file exists
if [ -e "$file" ]; then
NUMFILES=$((NUMFILES + 1))
Expand Down Expand Up @@ -126,6 +141,11 @@ function record_tests() {
if [ "$QUIET" -eq 1 ]; then
echo ". Complete"
fi

# rezip the package
(cd tmp && tar -zcvf $PROJECT.tar.gz $PROJECT &> /dev/null)
mv tmp/$PROJECT.tar.gz $PROJECT.tar.gz

echo "All tests recorded successfully!"
#rm -rf tmp/$PROJECT
}
Expand Down
42 changes: 28 additions & 14 deletions VortexEngine/tests/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ TODO=

declare -a REPOS
# Iterate through all the folders that start with "test_" in the current directory
for folder in tests_*/; do
# Remove the "./tests_" prefix and the final slash
for folder in tests_*.tar.gz; do
# Remove the "./tests_" prefix and the extension
folder_name=${folder#tests_}
folder_name=${folder_name%/}
folder_name=${folder_name%.tar.gz}
# Add the folder name to the array
REPOS+=("$folder_name")
done
Expand Down Expand Up @@ -54,6 +54,11 @@ select_repo() {
local original_PS3=$PS3
local repo

if [ "${#REPOS[@]}" -eq 1 ]; then
echo ${REPOS[0]}
return
fi

PS3='Please choose a repository: '

select repo in "${REPOS[@]}"; do
Expand All @@ -80,16 +85,29 @@ function run_tests() {
NUMFILES=0
FILES=

# clear tmp folder
rm -rf tmp/
mkdir -p tmp/

cp $PROJECT.tar.gz tmp/

# unzip the tests
(cd tmp && tar -xvf $PROJECT.tar.gz &> /dev/null)
if [ $? -ne 0 ]; then
echo "Failed to unzip $PROJECT.tar.gz: $!"
exit 1
fi

if [ "$TODO" != "" ]; then
FILES=$(find $PROJECT -name $(printf "%04d" $TODO)*.test)
FILES=$(find tmp/$PROJECT -name $(printf "%04d" $TODO)*.test)
if [ "$FILES" == "" ]; then
echo "Could not find test $TODO"
exit
fi
NUMFILES=1
else
# Iterate through the test files
for file in "$PROJECT"/*.test; do
for file in tmp/$PROJECT/*.test; do
# Check if the file exists
if [ -e "$file" ]; then
NUMFILES=$((NUMFILES + 1))
Expand All @@ -104,17 +122,13 @@ function run_tests() {

echo -e "\e[33m== [\e[97mRUNNING $NUMFILES $PROJECT INTEGRATION TESTS\e[33m] ==\e[0m"

# clear tmp folder
rm -rf tmp/$PROJECT
mkdir -p tmp/$PROJECT

TESTCOUNT=0

for FILE in $FILES; do
INPUT="$(grep "Input=" $FILE | cut -d= -f2)"
BRIEF="$(grep "Brief=" $FILE | cut -d= -f2)"
ARGS="$(grep "Args=" $FILE | cut -d= -f2)"
TESTNUM="$(echo $FILE | cut -d/ -f2 | cut -d_ -f1 | cut -d/ -f2)"
TESTNUM="$(echo $FILE | cut -d/ -f3 | cut -d_ -f1 | cut -d/ -f2)"
TESTNUM=$((10#$TESTNUM))
TESTCOUNT=$((TESTCOUNT + 1))
echo -e -n "\e[33mTesting $PROJECT ($TESTCOUNT/$NUMFILES) [\e[97m$BRIEF\e[33m] "
Expand All @@ -123,9 +137,9 @@ function run_tests() {
fi
echo -e -n "... \e[0m"
DIVIDER=$(grep -n -- "--------------------------------------------------------------------------------" $FILE | cut -f1 -d:)
EXPECTED="tmp/${FILE}.expected"
OUTPUT="tmp/${FILE}.output"
DIFFOUT="tmp/${FILE}.diff"
EXPECTED="${FILE}.expected"
OUTPUT="${FILE}.output"
DIFFOUT="${FILE}.diff"
tail -n +$(($DIVIDER + 1)) "$FILE" &> $EXPECTED
# run again?
if [ $AUDIT -eq 1 ]; then
Expand Down Expand Up @@ -163,7 +177,7 @@ function run_tests() {
if [ $ALLSUCCES -eq 1 ]; then
echo -e "\e[33m== [\e[32mSUCCESS ALL TESTS PASSED\e[33m] ==\e[0m"
# if so clear the tmp folder
rm -rf tmp/$PROJECT
rm -rf tmp/
else
if [ "$VERBOSE" -eq 1 ]; then
# otherwise cat the last diff
Expand Down
File renamed without changes.
Binary file added VortexEngine/tests/tests_general.tar.gz
Binary file not shown.
Loading

0 comments on commit e9d809e

Please sign in to comment.