Skip to content

Commit 82da8c6

Browse files
committed
test/t0001-oci-runtime-tool.t: Test --help and --version
Signed-off-by: W. Trevor King <wking@tremily.us>
1 parent 27f27d6 commit 82da8c6

3 files changed

Lines changed: 45 additions & 2 deletions

File tree

test/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Ocitools integration tests
1+
# oci-runtime-tool integration tests
22

3-
Ocitools uses the [Sharness][] test harness, installed as a [Git
3+
This project uses the [Sharness][] test harness, installed as a [Git
44
submodule]submodule]. To setup the test installation after a clone,
55
run:
66

@@ -17,6 +17,21 @@ Run the tests with:
1717
And read the `Makefile` source to find other useful targets
1818
(e.g. [`prove`][prove]).
1919

20+
## Naming
21+
22+
0 - Global `oci-runtime-tool` options.
23+
24+
## Dependencies
25+
26+
* [GNU Core Utilities][coreutils] for [`cat`][cat.1],
27+
[`echo`][echo.1], [`head`][head.1], and [`sed][sed.1].
28+
29+
[coreutils]: http://www.gnu.org/software/coreutils/coreutils.html
2030
[prove]: http://perldoc.perl.org/prove.html
2131
[Sharness]: http://mlafeldt.github.io/sharness/
2232
[submodule]: http://git-scm.com/docs/git-submodule
33+
34+
[cat.1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cat.html
35+
[echo.1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
36+
[head.1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html
37+
[sed.1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html

test/sharness.d/posix-utilities.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
command -v cat >/dev/null 2>/dev/null && test_set_prereq CAT
2+
command -v echo >/dev/null 2>/dev/null && test_set_prereq ECHO
3+
command -v head >/dev/null 2>/dev/null && test_set_prereq HEAD
4+
command -v sed >/dev/null 2>/dev/null && test_set_prereq SED
5+
6+
true

test/t0001-oci-runtime-tool.t

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
test_description='Test ocitools global options'
4+
5+
. ./sharness.sh
6+
7+
test_expect_success CAT,HEAD 'Test oci-runtime-tool --help' "
8+
oci-runtime-tool --help | head -n2 >actual &&
9+
cat <<-EOF >expected &&
10+
NAME:
11+
oci-runtime-tool - OCI (Open Container Initiative) runtime tools
12+
EOF
13+
test_cmp expected actual
14+
"
15+
16+
test_expect_success ECHO,SED 'Test oci-runtime-tool --version' "
17+
oci-runtime-tool --version | sed 's/commit: [0-9a-f]*$/commit: HASH/' >actual &&
18+
echo 'oci-runtime-tool version 0.0.1, commit: HASH' >expected &&
19+
test_cmp expected actual
20+
"
21+
22+
test_done

0 commit comments

Comments
 (0)