2022-06-28 18:28:44 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2022-06-28 19:53:38 +02:00
|
|
|
# Copyright 2022, FOSS-VG Developers and Contributers
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU Affero General Public License as published
|
|
|
|
# by the Free Software Foundation, version 3.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied
|
|
|
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# version 3 along with this program.
|
|
|
|
# If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
|
|
|
|
2022-07-30 21:10:07 +02:00
|
|
|
source scripts/lib.sh
|
2022-06-28 18:28:44 +02:00
|
|
|
|
|
|
|
echo -n "Using LD_LIBRARY_PATH "
|
|
|
|
if [ -z "$LD_LIBRARY_PATH" ]; then
|
|
|
|
export LD_LIBRARY_PATH=./bin/lib
|
|
|
|
else
|
|
|
|
export LD_LIBRARY_PATH=./bin/lib:"$LD_LIBRARY_PATH"
|
|
|
|
fi
|
|
|
|
echo "$LD_LIBRARY_PATH"
|
|
|
|
|
2022-08-13 15:37:25 +02:00
|
|
|
echo ">>> Cleaning tests..."
|
|
|
|
remove bin/test
|
2022-07-30 21:10:07 +02:00
|
|
|
create_directory bin/test
|
2022-06-28 18:28:44 +02:00
|
|
|
|
2022-08-13 00:28:36 +02:00
|
|
|
echo ">>> Building tests..."
|
2022-06-28 18:28:44 +02:00
|
|
|
|
2022-06-28 18:55:35 +02:00
|
|
|
# add compile commands to this array
|
|
|
|
COMPILE_COMMANDS=(
|
2022-10-30 04:55:58 +01:00
|
|
|
"$CXX_WITH_FLAGS src/test/nbt_read_write_helpers.cpp -I./include -Lbin/lib -l:nbt.so -o bin/test/nbt_read_write_helpers"
|
2022-07-15 11:33:02 +02:00
|
|
|
"$CXX_WITH_FLAGS src/test/cli_argument_parser.cpp -Lbin/lib -l:cli.so -o bin/test/cli_argument_parser"
|
2022-10-30 04:55:58 +01:00
|
|
|
"$CXX_WITH_FLAGS src/test/javacompat.cpp -I./include -Lbin/lib -o bin/test/javacompat"
|
|
|
|
"$CXX_WITH_FLAGS src/test/nbt_tags.cpp -I./include -Lbin/lib -l:nbt.so -o bin/test/nbt_tags"
|
|
|
|
"$CXX_WITH_FLAGS src/test/nbt_size_helpers.cpp -I./include -Lbin/lib -l:nbt.so -o bin/test/nbt_size_helpers"
|
2022-09-28 04:51:39 +02:00
|
|
|
"$CXX_WITH_FLAGS src/test/file.cpp -I./include -Lbin/lib -l:file.so -o bin/test/file"
|
2022-06-28 18:55:35 +02:00
|
|
|
)
|
|
|
|
for command in ${!COMPILE_COMMANDS[@]}; do
|
|
|
|
echo "${COMPILE_COMMANDS[command]}"
|
|
|
|
${COMPILE_COMMANDS[command]} &
|
2022-07-20 19:20:27 +02:00
|
|
|
$WAIT_ANYWAY
|
2022-06-28 18:55:35 +02:00
|
|
|
done
|
2022-06-28 18:28:44 +02:00
|
|
|
|
2022-06-28 18:55:35 +02:00
|
|
|
wait
|
|
|
|
|
2022-08-13 00:28:36 +02:00
|
|
|
echo ">>> Running tests..."
|
2022-06-28 18:55:35 +02:00
|
|
|
|
2022-08-13 00:28:36 +02:00
|
|
|
# explicitly allow commands to fail at this stage
|
2022-08-02 00:41:11 +02:00
|
|
|
set +e
|
2022-08-13 00:28:36 +02:00
|
|
|
|
2022-06-28 18:55:35 +02:00
|
|
|
for test in $(ls bin/test); do
|
|
|
|
bin/test/$test
|
|
|
|
done
|
2022-08-13 00:28:36 +02:00
|
|
|
|
|
|
|
for test in $(ls scripts/test); do
|
|
|
|
scripts/test/$test
|
|
|
|
done
|