fscrypt icon indicating copy to clipboard operation
fscrypt copied to clipboard

[testing] Tests fail if user keyring isn't linked into session keyring

Open paride opened this issue 7 years ago • 0 comments

If no key is linked to the keyring some tests fail. After running keyctl link @u @s the tests all succeed. Perhaps the test suite should add (and then remove) a key to the keyring? This is useful when testing in automated and non-interactive build environments, e.g. when using Debian sbuild/pbuilder. The output of the failing tests follows.

$ GOCACHE=off make test
go test -p 1 ./...
ok  	github.com/google/fscrypt/actions	0.002s
ok  	github.com/google/fscrypt/cmd/fscrypt	0.002s
2018/04/09 09:39:20 keyringID(_uid.1000) = 503951522, <nil>
2018/04/09 09:39:20 KeyctlLink(503951522, -2) = <nil>
2018/04/09 09:39:20 keyringID(session) = 420490118, <nil>
2018/04/09 09:39:20 KeyctlSearch(420490118, keyring, _uid.1000) = -1, required key not available
2018/04/09 09:39:20 KeyctlSearch(503951522, logon, fscrypt:0123456789abcdef) = -1, required key not available
2018/04/09 09:39:20 keyringID(session) = 420490118, <nil>
2018/04/09 09:39:20 KeyctlSearch(420490118, keyring, _uid.1000) = -1, required key not available
2018/04/09 09:39:20 KeyctlSearch(503951522, logon, ext4:0123456789abcdef) = -1, required key not available
2018/04/09 09:39:20 keyringID(session) = 420490118, <nil>
2018/04/09 09:39:20 KeyctlSearch(420490118, keyring, _uid.1000) = -1, required key not available
2018/04/09 09:39:20 KeyctlSearch(503951522, logon, f2fs:0123456789abcdef) = -1, required key not available
--- FAIL: TestAddRemoveKeys (0.00s)
	crypto_test.go:250: user keyring not linked into session keyring
	crypto_test.go:253: required key not available: could not find key with descriptor
	crypto_test.go:250: user keyring not linked into session keyring
	crypto_test.go:253: required key not available: could not find key with descriptor
	crypto_test.go:250: user keyring not linked into session keyring
	crypto_test.go:253: required key not available: could not find key with descriptor
2018/04/09 09:39:20 keyringID(session) = 420490118, <nil>
2018/04/09 09:39:20 KeyctlSearch(420490118, keyring, _uid.1000) = -1, required key not available
2018/04/09 09:39:20 keyringID(session) = 420490118, <nil>
2018/04/09 09:39:20 KeyctlSearch(420490118, keyring, _uid.1000) = -1, required key not available
2018/04/09 09:39:20 KeyctlSearch(503951522, logon, fscrypt:0123456789abcdef) = -1, required key not available
--- FAIL: TestAddTwice (0.00s)
	crypto_test.go:263: InsertPolicyKey should not fail if key already exists
2018/04/09 09:39:20 keyringID(session) = 420490118, <nil>
2018/04/09 09:39:20 KeyctlSearch(420490118, keyring, _uid.1000) = -1, required key not available
FAIL
FAIL	github.com/google/fscrypt/crypto	0.055s
ok  	github.com/google/fscrypt/filesystem	0.003s
ok  	github.com/google/fscrypt/metadata	0.002s
ok  	github.com/google/fscrypt/pam	0.002s
ok  	github.com/google/fscrypt/pam_fscrypt	0.002s
ok  	github.com/google/fscrypt/security	0.001s
ok  	github.com/google/fscrypt/util	0.002s
make: *** [Makefile:120: test] Error 1

paride avatar Apr 09 '18 07:04 paride