diff options
Diffstat (limited to '')
-rwxr-xr-x | tests/assert-identical.sh | 25 | ||||
-rwxr-xr-x | tests/cli-opts.sh | 2 | ||||
-rw-r--r-- | tests/fuzz/another.c | 17 | ||||
-rw-r--r-- | tests/fuzz/hello.c | 17 | ||||
-rw-r--r-- | tests/impl.c | 14 | ||||
-rw-r--r-- | tests/lib.c | 7 | ||||
-rw-r--r-- | tests/random.c | 4 | ||||
-rw-r--r-- | tests/resources/tweetnacl.c (renamed from tweetnacl.c) | 0 | ||||
-rw-r--r-- | tests/resources/tweetnacl.h (renamed from tweetnacl.h) | 0 |
9 files changed, 86 insertions, 0 deletions
diff --git a/tests/assert-identical.sh b/tests/assert-identical.sh new file mode 100755 index 0000000..1a25f62 --- /dev/null +++ b/tests/assert-identical.sh @@ -0,0 +1,25 @@ +#!/bin/sh +set -eu + +NAME='tweetnacl' +CFLAGS='-O3 -s' + +trap "rm -f tests/resources/impl.c src/impl.cmp.o tests/resources/impl.cmp.o" \ + EXIT + +( +cd src/ +gcc $CFLAGS -o impl.cmp.o -c impl.c +strip impl.cmp.o +) & + +( +cd tests/resources/ +cp "$NAME".c impl.c +gcc $CFLAGS -o impl.cmp.o -c impl.c +strip impl.cmp.o +) & + +wait + +cmp tests/resources/impl.cmp.o src/impl.cmp.o diff --git a/tests/cli-opts.sh b/tests/cli-opts.sh new file mode 100755 index 0000000..92b70ea --- /dev/null +++ b/tests/cli-opts.sh @@ -0,0 +1,2 @@ +#!/bin/sh +set -eu diff --git a/tests/fuzz/another.c b/tests/fuzz/another.c new file mode 100644 index 0000000..7fbfe07 --- /dev/null +++ b/tests/fuzz/another.c @@ -0,0 +1,17 @@ +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> + +static bool +fuzz_me(const uint8_t *const data, const size_t size) { + (void)data; + (void)size; + return true; +} + +int +LLVMFuzzerTestOneInput(const uint8_t *const data, const size_t size) { + int rc = 0; + fuzz_me(data, size); + return rc; +} diff --git a/tests/fuzz/hello.c b/tests/fuzz/hello.c new file mode 100644 index 0000000..7fbfe07 --- /dev/null +++ b/tests/fuzz/hello.c @@ -0,0 +1,17 @@ +#include <stdbool.h> +#include <stddef.h> +#include <stdint.h> + +static bool +fuzz_me(const uint8_t *const data, const size_t size) { + (void)data; + (void)size; + return true; +} + +int +LLVMFuzzerTestOneInput(const uint8_t *const data, const size_t size) { + int rc = 0; + fuzz_me(data, size); + return rc; +} diff --git a/tests/impl.c b/tests/impl.c new file mode 100644 index 0000000..e6c09c9 --- /dev/null +++ b/tests/impl.c @@ -0,0 +1,14 @@ +#include "../src/impl.c" + + +void +randombytes(u8 *FIXME1, u64 FIXME2) { + (void)FIXME1; + (void)FIXME2; +} + +int +main(void) { + // FIXME + return 0; +} diff --git a/tests/lib.c b/tests/lib.c new file mode 100644 index 0000000..597a837 --- /dev/null +++ b/tests/lib.c @@ -0,0 +1,7 @@ +#include "../src/lib.c" + + +int +main(void) { + return 0; +} diff --git a/tests/random.c b/tests/random.c new file mode 100644 index 0000000..1d658dd --- /dev/null +++ b/tests/random.c @@ -0,0 +1,4 @@ +int +main(void) { + return 0; +} diff --git a/tweetnacl.c b/tests/resources/tweetnacl.c index 8ac0a18..8ac0a18 100644 --- a/tweetnacl.c +++ b/tests/resources/tweetnacl.c diff --git a/tweetnacl.h b/tests/resources/tweetnacl.h index 9277fbf..9277fbf 100644 --- a/tweetnacl.h +++ b/tests/resources/tweetnacl.h |