-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Zoltan Fridrich <[email protected]>
- Loading branch information
1 parent
7756404
commit 81c9e74
Showing
4 changed files
with
112 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#!/bin/sh | ||
|
||
set -euf | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Basic fundamentals | ||
|
||
prefix=/usr/local | ||
exec_prefix=${prefix} | ||
datarootdir=${prefix}/share | ||
datadir=${datarootdir} | ||
sysconfdir=${prefix}/etc | ||
libdir=${exec_prefix}/lib | ||
libexecdir=${exec_prefix}/libexec | ||
privatedir=${libexecdir}/p11-kit | ||
with_trust_paths=/etc/pki/tls/certs/ca-bundle.crt | ||
script=$(basename $0) | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Testing | ||
|
||
warning() | ||
{ | ||
echo "$script: $@" >&2 | ||
} | ||
|
||
assert_fail() | ||
{ | ||
warning $@ | ||
exit 1 | ||
} | ||
|
||
assert_contains() | ||
{ | ||
if ! grep -qF "$2" "$1"; then | ||
assert_fail "$1 does not contain $2" | ||
fi | ||
} | ||
|
||
assert_not_contains() | ||
{ | ||
if grep -qF "$2" "$1"; then | ||
assert_fail "$1 contains $2" | ||
fi | ||
} | ||
|
||
teardown() | ||
{ | ||
: | ||
} | ||
|
||
teardown_dirty() | ||
{ | ||
echo "not ok $TEST_NUMBER $TEST_NAME" | ||
teardown | ||
} | ||
|
||
skip() | ||
{ | ||
TEST_SKIP=yes | ||
echo "ok $TEST_NUMBER # skip $TEST_NAME: $@" | ||
} | ||
|
||
setup() | ||
{ | ||
: | ||
} | ||
|
||
run() | ||
{ | ||
TOTAL=0 | ||
for TEST_NAME in $@; do | ||
TOTAL=$(expr $TOTAL + 1) | ||
done | ||
|
||
echo "1..$TOTAL" | ||
|
||
TEST_NUMBER=0 | ||
for TEST_NAME in $@; do | ||
TEST_NUMBER=$(expr $TEST_NUMBER + 1) | ||
( | ||
trap teardown_dirty EXIT | ||
trap "teardown_dirty; exit 127" INT TERM | ||
TD="" | ||
|
||
PATH="$exec_prefix/bin:$PATH" | ||
export PATH | ||
|
||
PKG_CONFIG_PATH="$libdir/pkgconfig:$datadir/pkgconfig" | ||
export PKG_CONFIG_PATH | ||
|
||
TEST_SKIP=no | ||
setup | ||
|
||
if [ $TEST_SKIP != "yes" ]; then | ||
$TEST_NAME | ||
fi | ||
if [ $TEST_SKIP != "yes" ]; then | ||
echo "ok $TEST_NUMBER $TEST_NAME" | ||
fi | ||
|
||
trap - EXIT | ||
teardown | ||
) | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters