1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

move tests into tests/

This commit is contained in:
Pavol Rusnak 2018-04-05 13:26:59 +02:00
parent e81fb38ab4
commit 7111431890
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
10 changed files with 25 additions and 67 deletions

11
.gitignore vendored
View File

@ -1,13 +1,14 @@
.cache/
.vscode/
_attic/
*.o
*.d
*.exe
*~
test_openssl
test_speed
test_check
aes/aestst
tests/aestst
tests/test_openssl
tests/test_speed
tests/test_check
tests/libtrezor-crypto.so
*.os
*.so
*.pyc

View File

@ -21,12 +21,11 @@ install:
script:
- make
- ./aes/aestst
- ./test_check
- CK_TIMEOUT_MULTIPLIER=20 valgrind -q --error-exitcode=1 ./test_check
- ./test_openssl 1000
- ITERS=10 py.test
- mkdir _build && cd _build && cmake .. && make && cd ..
- ./tests/aestst
- ./tests/test_check
- CK_TIMEOUT_MULTIPLIER=20 valgrind -q --error-exitcode=1 ./tests/test_check
- ./tests/test_openssl 1000
- cd ./tests ; ITERS=10 pytest ; cd ..
notifications:
webhooks:

View File

@ -1,44 +0,0 @@
cmake_minimum_required(VERSION 2.8)
set(SOURCES
bignum.c ecdsa.c curves.c secp256k1.c nist256p1.c rand.c hmac.c bip32.c bip39.c pbkdf2.c base58.c base32.c
address.c
script.c
ripemd160.c
sha2.c
sha3.c
hasher.c
aes/aescrypt.c aes/aeskey.c aes/aestab.c aes/aes_modes.c
ed25519-donna/curve25519-donna-32bit.c ed25519-donna/curve25519-donna-helpers.c ed25519-donna/modm-donna-32bit.c
ed25519-donna/ed25519-donna-basepoint-table.c ed25519-donna/ed25519-donna-32bit-tables.c ed25519-donna/ed25519-donna-impl-base.c
ed25519-donna/ed25519.c ed25519-donna/curve25519-donna-scalarmult-base.c ed25519-donna/ed25519-sha3.c ed25519-donna/ed25519-keccak.c
blake256.c
blake2b.c blake2s.c
chacha20poly1305/chacha20poly1305.c chacha20poly1305/chacha_merged.c chacha20poly1305/poly1305-donna.c chacha20poly1305/rfc7539.c
rc4.c
nem.c
)
add_library(TrezorCrypto STATIC ${SOURCES})
target_include_directories(TrezorCrypto PUBLIC .)
target_include_directories(TrezorCrypto PUBLIC aes)
target_include_directories(TrezorCrypto PUBLIC chacha20poly1305)
target_include_directories(TrezorCrypto PUBLIC ed25519-donna)
target_compile_options(TrezorCrypto PRIVATE "-std=c99")
if(MSVC)
set_source_files_properties(${SOURCES} PROPERTIES LANGUAGE CXX)
endif(MSVC)
# Build trezor-crypto tests (requires OpenSSL)
if (TREZOR_CRYPTO_TESTS)
add_executable(test_check test_check.c)
target_link_libraries(test_check TrezorCrypto check rt pthread m crypto)
add_test(NAME trezor-crypto COMMAND test_check)
add_executable(test_openssl test_openssl.c)
target_link_libraries(test_openssl TrezorCrypto check rt pthread m crypto)
add_test(NAME trezor-crypto-openssl COMMAND test_openssl 100)
endif()

View File

@ -58,27 +58,29 @@ OBJS = $(SRCS:.c=.o)
TESTLIBS = $(shell pkg-config --libs check) -lpthread -lm
TESTSSLLIBS = $(shell pkg-config --libs openssl)
all: test_check test_openssl test_speed aes/aestst tools libtrezor-crypto.so
all: tools tests
%.o: %.c %.h options.h
$(CC) $(CFLAGS) -o $@ -c $<
test_check.o: test_check_segwit.h test_check_cashaddr.h
tests: tests/test_check tests/test_openssl tests/test_speed tests/libtrezor-crypto.so tests/aestst
aes/aestst: aes/aestst.o aes/aescrypt.o aes/aeskey.o aes/aestab.o
tests/aestst: aes/aestst.o aes/aescrypt.o aes/aeskey.o aes/aestab.o
$(CC) $^ -o $@
test_check: test_check.o $(OBJS)
$(CC) test_check.o $(OBJS) $(TESTLIBS) -o test_check
tests/test_check.o: tests/test_check_segwit.h tests/test_check_cashaddr.h
test_speed: test_speed.o $(OBJS)
$(CC) test_speed.o $(OBJS) -o test_speed
tests/test_check: tests/test_check.o $(OBJS)
$(CC) tests/test_check.o $(OBJS) $(TESTLIBS) -o tests/test_check
test_openssl: test_openssl.o $(OBJS)
$(CC) test_openssl.o $(OBJS) $(TESTSSLLIBS) -o test_openssl
tests/test_speed: tests/test_speed.o $(OBJS)
$(CC) tests/test_speed.o $(OBJS) -o tests/test_speed
libtrezor-crypto.so: $(SRCS)
$(CC) $(CFLAGS) -fPIC -shared $(SRCS) -o libtrezor-crypto.so
tests/test_openssl: tests/test_openssl.o $(OBJS)
$(CC) tests/test_openssl.o $(OBJS) $(TESTSSLLIBS) -o tests/test_openssl
tests/libtrezor-crypto.so: $(SRCS)
$(CC) $(CFLAGS) -fPIC -shared $(SRCS) -o tests/libtrezor-crypto.so
tools: tools/xpubaddrgen tools/mktable tools/bip39bruteforce
@ -93,5 +95,5 @@ tools/bip39bruteforce: tools/bip39bruteforce.o $(OBJS)
clean:
rm -f *.o aes/*.o chacha20poly1305/*.o ed25519-donna/*.o
rm -f test_check test_speed test_openssl libtrezor-crypto.so
rm -f tests/test_check tests/test_speed tests/test_openssl tests/libtrezor-crypto.so tests/aestst
rm -f tools/*.o tools/xpubaddrgen tools/mktable tools/bip39bruteforce