Build system: Improve output readability and prepare for script based unit tests

BodgeMaster-unfinished
BodgeMaster 2022-08-13 00:28:36 +02:00
parent 748c91c375
commit e882a09099
6 changed files with 30 additions and 14 deletions

View File

@ -33,7 +33,7 @@ fi
# `.cpp` files in src/lib will be automatically picked up and compiled into
# dynamically linked libraries.
echo "Building libs..."
echo ">>> Building libs..."
create_directory bin/lib
for lib in $(find ./src/lib -name "*.cpp"); do
COMPILE_COMMAND="$CXX_WITH_FLAGS -I ./include -fPIC -shared -o $(sed -e 's/^.\/src/.\/bin/;s/cpp$/so/' <<< $lib) $lib"
@ -55,7 +55,7 @@ wait
# How to run a tool: specify the library path to use for the dynamic linker
# when running a program
# Example: LD_LIBRARY_PATH=bin/lib bin/tools/dumpnbt
echo "Building tools..."
echo ">>> Building tools..."
create_directory bin/tools
# add compile commands to this array
COMPILE_COMMANDS=(

View File

@ -15,6 +15,8 @@
# version 3 along with this program.
# If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
echo ">>> Cleaning build files..."
source scripts/lib.sh
remove ./bin

View File

@ -17,7 +17,7 @@
source scripts/lib.sh
echo "Checking download cache for unneeded or corrupted files..."
echo ">>> Checking download cache for unneeded or corrupted files..."
for file in $(ls .download_cache); do
#TODO: remove if unknown shasum
if grep $file scripts/setup_project.sh >/dev/null 2>&1; then
@ -32,7 +32,8 @@ for file in $(ls .download_cache); do
rm ".download_cache/$file"
fi
done
echo ""
echo "
>>> Cleaning dependencies..."
remove ./dependencies
create_directory ./dependencies

View File

@ -72,9 +72,7 @@ function download {
fi
}
echo "Cleaning build files..."
scripts/clean.sh
echo "Cleaning dependencies..."
scripts/clean_dependencies.sh
set -e # failures are not acceptable here
@ -82,20 +80,21 @@ create_directory dependencies/tmp
download https://github.com/DuffsDevice/tiny-utf8/archive/refs/tags/v4.4.3.tar.gz dependencies/tmp/tiny-utf8.tar.gz 8e3f61651909c9f3105d3501932a96aa65733127fb6e7cf94cb1b0a2dff42c8f
download https://github.com/fpagliughi/sockpp/archive/refs/tags/v0.7.1.tar.gz dependencies/tmp/sockpp.tar.gz 2e023528bebbd2ac083fc91fbe6d5c4158c3336bedbcff48f594f3b28f53b940
echo -n "Extracting tiny-utf8... "
echo -n ">>> Extracting tiny-utf8... "
gzip -d dependencies/tmp/tiny-utf8.tar.gz
tar -xf dependencies/tmp/tiny-utf8.tar -C dependencies
echo "done."
echo "done"
echo -n "Extracting sockpp... "
echo -n ">>> Extracting sockpp... "
gzip -d dependencies/tmp/sockpp.tar.gz
tar -xf dependencies/tmp/sockpp.tar -C dependencies
echo "done."
echo -n "Building sockpp... "
echo "done"
echo ">>> Building sockpp... "
pushd dependencies/sockpp-0.7.1/ >/dev/null 2>&1
cmake -Bbuild .
cmake --build build
popd >/dev/null 2>&1
echo "done."
echo ">>> Cleaning up..."
remove dependencies/tmp

View File

@ -27,7 +27,7 @@ echo "$LD_LIBRARY_PATH"
create_directory bin/test
echo "Building tests..."
echo ">>> Building tests..."
# add compile commands to this array
COMPILE_COMMANDS=(
@ -45,9 +45,15 @@ done
wait
echo "Running tests..."
echo ">>> Running tests..."
# explicitly allow commands to fail at this stage
set +e
for test in $(ls bin/test); do
bin/test/$test
done
for test in $(ls scripts/test); do
scripts/test/$test
done

8
scripts/test/hexnet.sh Normal file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
echo "################################################################################
Testing hexnet
################################################################################"
echo "Test not yet implemented."
#TODO: implement unit test after merging back with master