diff options
author | Andrew G. Morgan <morgan@kernel.org> | 2019-05-19 14:57:20 -0700 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2019-05-19 14:57:20 -0700 |
commit | 0615d996379dceedefcd65a114f93fefd81c208f (patch) | |
tree | 590edde235e563c88b62b913a449cc43884d1be2 /progs/quicktest.sh | |
parent | ac1ef3125f50594289a2d9a4de3b5a22d2882ea4 (diff) | |
download | libcap-0615d996379dceedefcd65a114f93fefd81c208f.tar.gz |
A Go (golang) implementation of libcap: import "libcap/cap".
The API for this "libcap/cap" package is very similar to libcap.
I've included a substantial interoperability test that validate
libcap(c) and libcap/cap(go) have import/export text and binary
format compatibility.
My motivation for implementing a standalone Go package was for a
cross-compilation issue I ran into (Go is much more friendly for
cross-compilation by default, unless you need to use cgo).
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
Diffstat (limited to 'progs/quicktest.sh')
-rwxr-xr-x | progs/quicktest.sh | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/progs/quicktest.sh b/progs/quicktest.sh index 1f97e1f..33c46a8 100755 --- a/progs/quicktest.sh +++ b/progs/quicktest.sh @@ -154,11 +154,6 @@ pass_capsh --chroot=$(/bin/pwd) pass_capsh --chroot=$(/bin/pwd) == fail_capsh --chroot=$(/bin/pwd) -- -c "echo oops" -exit_early () { - echo "$*" - exit 0 -} - ./capsh --has-ambient if [ $? -eq 0 ]; then echo "test ambient capabilities" @@ -219,3 +214,21 @@ else echo "ns file caps not supported - skipping test" fi rm -f nsprivileged + +# If the build tree compiled the Go cap package. +if [ -f ../go/compare-cap ]; then + cp ../go/compare-cap . + ./compare-cap + if [ $? -ne 0 ]; then + echo "FAILED to execute go binary" + exit 1 + fi + ./compare-cap 2>&1 | grep "skipping file cap tests" + if [ $? -eq 0 ]; then + echo "FAILED not engaging file cap tests" + fi + echo "PASSED" +else + echo "no Go support compiled" +fi +rm -f compare-cap |