Files
clrtrust/test/copy-negative.bats
Arzhan Kinzhalin 35da1895e6 Add helper binary for bulk certificate processing.
Instead of launching 'openssl x509' for each file, use small binary to
process files in bulk. This optimization improves performance more than
7 times (measured on store generation). Performance of 'clrtrust
generate' is important for first-time booting.
2018-04-16 00:43:56 -07:00

36 lines
784 B
Bash
Executable File

#!/usr/bin/env bats
# Copyright 2017 Intel Corporation
load test_lib
setup() {
find_clrtrust
setup_fs
# copy bad certificate
cp $CERTS/bad/non-cert.txt $CLR_LOCAL_TRUST_SRC/trusted
# copy good certificate
cp $CERTS/c1.pem $CLR_LOCAL_TRUST_SRC/trusted
}
@test "helper returns error code 2 if bad certificate found" {
find $CLR_LOCAL_TRUST_SRC/trusted -type f | {
run $CLRTRUST_HELPER -f
echo $output
# should return 2
[ $status -eq 2 ]
}
}
@test "generate returns error code 127 if bad certificate found" {
run $CLRTRUST generate
# should return 127
echo "$output" | grep "is not a PEM-encoded X.509"
[ $status -eq 127 ]
}
teardown() {
remove_fs
}
# vim: ft=sh:sw=4:ts=4:et:tw=80:si:noai:nocin