Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing tests, cleanup issues w/running tests locally #301

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/sh

mkdir -p tmp/bin
TESTS=$(find test/* -type f -perm -111)
ctrl_c () {
echo "Ctrl+c detected. Exiting..."
exit 1
}

trap ctrl_c INT

TESTS=$(find test/*.sh -type f -perm -111)
EXIT_CODE=0
export PATH="$PWD:$PATH"

Expand All @@ -17,21 +23,20 @@ for t in $TESTS; do
done
echo


printf "\nRunning clib package tests\n\n"
cd test/package && make clean

if ! make test; then
EXIT_CODE=1
EXIT_CODE=1
fi

cd ../../

printf "\nRunning clib cache tests\n\n"
cd test/cache
cd test/cache && make clean

if ! make test; then
EXIT_CODE=1
EXIT_CODE=1
fi

cd ../../
Expand Down
4 changes: 4 additions & 0 deletions test/install-binary-dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#!/bin/sh

mkdir -p tmp/bin
trap 'rm -rf tmp' EXIT

clib install -c -N stephenmathieson/tabs-to-spaces@1.0.0 -P tmp > /dev/null || {
echo >&2 "Failed to install stephenmathieson/tabs-to-spaces"
exit 1
}

command -v tmp/bin/t2s >/dev/null 2>&1 || {
echo >&2 "Failed to put t2s on path"
exit 1
Expand Down
4 changes: 2 additions & 2 deletions test/install-brace-expansion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ throw() {
exit 1
}

trap 'rm -rf tmp' EXIT

clib install -c -N -o tmp stephenmathieson/trim.c stephenmathieson/case.c > /dev/null ||
throw "expecting successful exit code"

Expand All @@ -13,5 +15,3 @@ clib install -c -N -o tmp stephenmathieson/trim.c stephenmathieson/case.c > /dev

[ -d ./tmp/trim ] && [ -f ./tmp/trim/package.json ] ||
throw "failed to install trim.c"

rm -rf ./tmp
4 changes: 2 additions & 2 deletions test/install-deps-from-package-json.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ throw() {
exit 1
}

rm -rf tmp
mkdir -p tmp
trap 'rm -rf tmp' EXIT

cd tmp || exit

# see https://github.com/clibs/clib/issues/45
Expand All @@ -25,4 +26,3 @@ clib install > /dev/null 2>&1
[ $? -eq 1 ] || throw "expecting exit code of 1";

cd - > /dev/null || exit
rm -rf ./tmp
4 changes: 2 additions & 2 deletions test/install-multiple-clibs-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ throw() {
exit 1
}

trap 'rm -rf tmp' EXIT

clib install -c -N -o tmp ms file hash > /dev/null ||
throw "expecting successful exit code"

Expand All @@ -16,5 +18,3 @@ clib install -c -N -o tmp ms file hash > /dev/null ||

[ -d ./tmp/hash ] && [ -f ./tmp/hash/package.json ] ||
throw "failed to install hash"

rm -rf ./tmp
4 changes: 2 additions & 2 deletions test/install-multiple-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ throw() {
exit 1
}

trap 'rm -rf tmp' EXIT

clib install -c -N -o tmp \
stephenmathieson/case.c stephenmathieson/trim.c > /dev/null ||
throw "expecting successful exit code"
Expand All @@ -14,5 +16,3 @@ clib install -c -N -o tmp \

[ -d ./tmp/trim ] && [ -f ./tmp/trim/package.json ] ||
throw "failed to install trim.c"

rm -rf ./tmp
7 changes: 5 additions & 2 deletions test/install-no-save.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/bin/sh
mkdir -p tmp/test-save
mkdir -p tmp/test-save/bin
RUNDIR="$PWD"
trap 'rm -rf "$RUNDIR/tmp"' EXIT

cp test/data/test-save-package.json tmp/test-save/package.json

cd tmp/test-save || exit
../../clib-install -c --no-save stephenmathieson/tabs-to-spaces@1.0.0 >/dev/null
../../clib-install -c --no-save stephenmathieson/tabs-to-spaces@1.0.0 -P . >/dev/null
../../clib-install -c -N darthtrevino/str-concat@0.0.2 >/dev/null
../../clib-install -c --dev --no-save jwerle/fs.c@0.1.1 >/dev/null
../../clib-install -c -d --no-save clibs/parson@1.0.2 >/dev/null
Expand Down
7 changes: 5 additions & 2 deletions test/install-save.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/bin/sh
mkdir -p tmp/test-save
mkdir -p tmp/test-save/bin
RUNDIR="$PWD"
trap 'rm -rf "$RUNDIR/tmp"' EXIT

cp test/data/test-save-package.json tmp/test-save/package.json

cd tmp/test-save || exit
../../clib-install -c stephenmathieson/tabs-to-spaces@1.0.0 >/dev/null
../../clib-install -c stephenmathieson/tabs-to-spaces@1.0.0 -P . >/dev/null
../../clib-install -c darthtrevino/str-concat@0.0.2 >/dev/null
../../clib-install -c --dev jwerle/fs.c@0.1.1 >/dev/null
../../clib-install -c -D clibs/parson@1.0.2 >/dev/null
Expand Down
2 changes: 1 addition & 1 deletion test/uninstall.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

mkdir -p tmp/bin
trap 'rm -rf tmp' EXIT

clib install -c -N stephenmathieson/tabs-to-spaces@1.0.0 -P tmp > /dev/null || {
echo >&2 "Failed to install stephenmathieson/tabs-to-spaces"
Expand Down
Loading