-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Port shell-script tests to using test-init.sh
Signed-off-by: Daiki Ueno <[email protected]>
- Loading branch information
1 parent
ef2e9fd
commit 65b2e47
Showing
4 changed files
with
176 additions
and
175 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 |
---|---|---|
@@ -1,30 +1,34 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
test "${abs_top_builddir+set}" = set || { | ||
echo "set abs_top_builddir" 1>&2 | ||
exit 1 | ||
} | ||
|
||
testdir=$PWD/test-profiles-$$ | ||
test -d "$testdir" || mkdir "$testdir" | ||
. "$abs_top_builddir/common/test-init.sh" | ||
|
||
cleanup () { | ||
rm -rf "$testdir" | ||
setup() { | ||
testdir=$PWD/test-profiles-$$ | ||
test -d "$testdir" || mkdir "$testdir" | ||
cd "$testdir" | ||
} | ||
trap cleanup 0 | ||
|
||
cd "$testdir" | ||
teardown() { | ||
rm -rf "$testdir" | ||
} | ||
|
||
cat > list.exp <<EOF | ||
test_list_profiles() { | ||
cat > list.exp <<EOF | ||
public-certificates-token | ||
EOF | ||
|
||
"$abs_top_builddir"/p11-kit/p11-kit-testable list-profiles -q pkcs11: > list.out | ||
"$abs_top_builddir"/p11-kit/p11-kit-testable list-profiles -q pkcs11: > list.out | ||
|
||
echo 1..1 | ||
: ${DIFF=diff} | ||
if ! ${DIFF} list.exp list.out > list.diff; then | ||
sed 's/^/# /' list.diff | ||
assert_fail "output contains wrong results" | ||
fi | ||
} | ||
|
||
: ${DIFF=diff} | ||
if ${DIFF} list.exp list.out > list.diff; then | ||
echo "ok 1 /profiles/list" | ||
else | ||
echo "not ok 1 /profiles/list" | ||
sed 's/^/# /' list.diff | ||
exit 1 | ||
fi | ||
run test_list_profiles |
Oops, something went wrong.