FOSS-VG/scripts/test.sh

56 lines
1.6 KiB
Bash
Raw Normal View History

2022-06-28 18:28:44 +02:00
#!/usr/bin/env bash
# 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-06-28 18:28:44 +02:00
if [ -z "$CXX" ]; then
CXX="c++"
fi
if [ -z "$CXXFLAGS" ]; then
CXXFLAGS="-std=c++20 -Wall"
fi
CXX_WITH_FLAGS="$CXX $CXXFLAGS"
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"
mkdir -pv bin/test
2022-06-28 18:55:35 +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=(
"$CXX_WITH_FLAGS src/test/nbt_helpers.cpp -Lbin/lib -l:nbt.so -o bin/test/nbt_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-07-18 08:43:10 +02:00
"$CXX_WITH_FLAGS src/test/java_string.cpp -Idependencies/tiny-utf8-4.4.3/include -Lbin/lib -l:java_string.so -o bin/test/java_string"
2022-06-28 18:55:35 +02:00
)
for command in ${!COMPILE_COMMANDS[@]}; do
echo "${COMPILE_COMMANDS[command]}"
${COMPILE_COMMANDS[command]} &
done
2022-06-28 18:28:44 +02:00
2022-06-28 18:55:35 +02:00
wait
echo "Running tests..."
for test in $(ls bin/test); do
bin/test/$test
done