Skip to content

Commit 64b8e65

Browse files
authored
Test infra improvements (#1915)
* Do not manually enumerate tests in each and every CI build script * Refactor test expectation macros to output failing line in logs Previously, logs first recorded a random source line and then message contained the line where the expectation failed. * Add non-asserting test expectation macros These fail test instead of killing the process. * Print test results in the nicer format by default Let's reserve LOG(ERROR) for errors. Unfortunately, we cannot use this everywhere as test runner is also used in TonlibClient, where custom log redirections can be set up.
1 parent 9e2c343 commit 64b8e65

File tree

13 files changed

+170
-67
lines changed

13 files changed

+170
-67
lines changed

CMakeLists.txt

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,13 @@ function(target_link_libraries_system target)
401401
endforeach(lib)
402402
endfunction(target_link_libraries_system)
403403

404+
add_custom_target(all-tests)
405+
406+
function(ton_test TEST_NAME)
407+
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME} ${ARGN})
408+
add_dependencies(all-tests ${TEST_NAME})
409+
endfunction()
410+
404411
set(TDUTILS_MIME_TYPE OFF CACHE BOOL "Generate mime type conversion")
405412
add_subdirectory(tdutils)
406413
add_subdirectory(memprof)
@@ -575,20 +582,18 @@ endif()
575582
enable_testing()
576583
set(TEST_OPTIONS "--regression ${CMAKE_CURRENT_SOURCE_DIR}/test/regression-tests.ans --filter -Bench")
577584
separate_arguments(TEST_OPTIONS)
578-
add_test(test-ed25519 test-ed25519)
579-
add_test(test-bigint test-bigint)
580-
add_test(test-vm test-vm ${TEST_OPTIONS})
581-
add_test(test-fift test-fift ${TEST_OPTIONS})
582-
add_test(test-cells test-cells ${TEST_OPTIONS})
583-
add_test(test-smartcont test-smartcont)
584-
add_test(test-net test-net)
585-
add_test(test-actors test-tdactor)
586-
add_test(test-actors-coro tdactor/test/test-coro)
587-
add_test(test-emulator test-emulator)
585+
ton_test(test-ed25519)
586+
ton_test(test-bigint)
587+
ton_test(test-vm ${TEST_OPTIONS})
588+
ton_test(test-fift ${TEST_OPTIONS})
589+
ton_test(test-cells ${TEST_OPTIONS})
590+
ton_test(test-smartcont)
591+
ton_test(test-net)
592+
ton_test(test-tdactor)
588593

589594
#BEGIN tonlib
590-
add_test(test-tdutils test-tdutils)
591-
add_test(test-tonlib-offline test-tonlib-offline)
595+
ton_test(test-tdutils)
596+
ton_test(test-tonlib-offline)
592597
#END tonlib
593598

594599
# FunC tests
@@ -657,15 +662,16 @@ endif()
657662

658663
#BEGIN internal
659664
if (NOT TON_ONLY_TONLIB)
660-
add_test(test-adnl test-adnl)
661-
add_test(test-dht test-dht)
662-
add_test(test-rldp test-rldp)
663-
add_test(test-rldp2 test-rldp2)
664-
add_test(test-validator-session-state test-validator-session-state)
665-
add_test(test-catchain test-catchain)
666-
667-
add_test(test-fec test-fec)
668-
add_test(test-tddb test-tddb ${TEST_OPTIONS})
669-
add_test(test-db test-db ${TEST_OPTIONS})
665+
ton_test(test-adnl)
666+
ton_test(test-dht)
667+
ton_test(test-rldp)
668+
ton_test(test-rldp2)
669+
ton_test(test-validator-session-state)
670+
ton_test(test-catchain)
671+
ton_test(test-emulator)
672+
673+
ton_test(test-fec)
674+
ton_test(test-tddb ${TEST_OPTIONS})
675+
ton_test(test-db ${TEST_OPTIONS})
670676
endif()
671677
#END internal

assembly/native/build-macos-portable.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,7 @@ if [ "$with_tests" = true ]; then
153153
ninja storage-daemon storage-daemon-cli blockchain-explorer \
154154
tonlib tonlibjson tonlib-cli validator-engine func tolk fift \
155155
lite-client validator-engine-console generate-random-id json2tlo dht-server dht-ping-servers dht-resolve \
156-
http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator \
157-
test-ed25519 test-bigint test-vm test-fift test-cells test-smartcont \
158-
test-net test-tdactor test-coro test-tdutils test-tonlib-offline test-adnl test-dht test-rldp \
159-
test-rldp2 test-catchain test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver
156+
http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator proxy-liteserver all-tests
160157
test $? -eq 0 || { echo "Can't compile ton"; exit 1; }
161158
else
162159
ninja storage-daemon storage-daemon-cli blockchain-explorer \

assembly/native/build-macos-shared.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,7 @@ if [ "$with_tests" = true ]; then
9191
ninja storage-daemon storage-daemon-cli blockchain-explorer \
9292
tonlib tonlibjson tonlib-cli validator-engine func tolk fift \
9393
lite-client validator-engine-console generate-random-id json2tlo dht-server dht-ping-servers dht-resolve \
94-
http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator \
95-
test-ed25519 test-bigint test-vm test-fift test-cells test-smartcont \
96-
test-net test-tdactor test-coro test-tdutils test-tonlib-offline test-adnl test-dht test-rldp \
97-
test-rldp2 test-catchain test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver
94+
http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork tlbc emulator proxy-liteserver all-tests
9895
test $? -eq 0 || { echo "Can't compile ton"; exit 1; }
9996
else
10097
ninja storage-daemon storage-daemon-cli blockchain-explorer \

assembly/native/build-ubuntu-appimages.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ if [ "$with_tests" = true ]; then
6262
ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \
6363
validator-engine lite-client validator-engine-console blockchain-explorer \
6464
generate-random-id json2tlo dht-server http-proxy rldp-http-proxy dht-ping-servers dht-resolve \
65-
adnl-proxy create-state emulator test-ed25519 test-bigint \
66-
test-vm test-fift test-cells test-smartcont test-net test-tdactor test-coro test-tdutils \
67-
test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain \
68-
test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver
65+
adnl-proxy create-state emulator proxy-liteserver all-tests
6966
test $? -eq 0 || { echo "Can't compile ton"; exit 1; }
7067
else
7168
ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \

assembly/native/build-ubuntu-portable.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,7 @@ if [ "$with_tests" = true ]; then
136136
ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \
137137
validator-engine lite-client validator-engine-console blockchain-explorer \
138138
generate-random-id json2tlo dht-server http-proxy rldp-http-proxy dht-ping-servers dht-resolve \
139-
adnl-proxy create-state emulator test-ed25519 test-bigint \
140-
test-vm test-fift test-cells test-smartcont test-net test-tdactor test-coro test-tdutils \
141-
test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain \
142-
test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver
139+
adnl-proxy create-state emulator proxy-liteserver all-tests
143140
test $? -eq 0 || { echo "Can't compile ton"; exit 1; }
144141
else
145142
ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \

assembly/native/build-ubuntu-shared.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,7 @@ if [ "$with_tests" = true ]; then
6565
ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \
6666
validator-engine lite-client validator-engine-console blockchain-explorer \
6767
generate-random-id json2tlo dht-server http-proxy rldp-http-proxy dht-ping-servers dht-resolve \
68-
adnl-proxy create-state emulator test-ed25519 test-bigint \
69-
test-vm test-fift test-cells test-smartcont test-net test-tdactor test-coro test-tdutils \
70-
test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain \
71-
test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver
68+
adnl-proxy create-state emulator proxy-liteserver all-tests
7269
test $? -eq 0 || { echo "Can't compile ton"; exit 1; }
7370
else
7471
ninja storage-daemon storage-daemon-cli fift func tolk tonlib tonlibjson tonlib-cli \

assembly/native/build-windows-2019.bat

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ IF "%1"=="-t" (
147147
ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tolk tonlib tonlibjson ^
148148
tonlib-cli validator-engine lite-client validator-engine-console generate-random-id ^
149149
json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork emulator ^
150-
test-ed25519 test-bigint test-vm test-fift test-cells test-smartcont test-net ^
151-
test-tdactor test-coro test-tdutils test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain ^
152-
test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver dht-ping-servers dht-resolve
150+
proxy-liteserver dht-ping-servers dht-resolve all-tests
153151
IF %errorlevel% NEQ 0 (
154152
echo Can't compile TON
155153
exit /b %errorlevel%

assembly/native/build-windows-2022.bat

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ IF "%1"=="-t" (
147147
ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tolk tonlib tonlibjson ^
148148
tonlib-cli validator-engine lite-client validator-engine-console generate-random-id ^
149149
json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork emulator ^
150-
test-ed25519 test-bigint test-vm test-fift test-cells test-smartcont test-net ^
151-
test-tdactor test-coro test-tdutils test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain ^
152-
test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver
150+
proxy-liteserver all-tests
153151
IF %errorlevel% NEQ 0 (
154152
echo Can't compile TON
155153
exit /b %errorlevel%

assembly/native/build-windows.bat

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ IF "%1"=="-t" (
147147
ninja storage-daemon storage-daemon-cli blockchain-explorer fift func tolk tonlib tonlibjson ^
148148
tonlib-cli validator-engine lite-client validator-engine-console generate-random-id ^
149149
json2tlo dht-server http-proxy rldp-http-proxy adnl-proxy create-state create-hardfork emulator ^
150-
test-ed25519 test-bigint test-vm test-fift test-cells test-smartcont test-net ^
151-
test-tdactor test-coro test-tdutils test-tonlib-offline test-adnl test-dht test-rldp test-rldp2 test-catchain ^
152-
test-fec test-tddb test-db test-validator-session-state test-emulator proxy-liteserver dht-ping-servers dht-resolve
150+
proxy-liteserver dht-ping-servers dht-resolve all-tests
153151
IF %errorlevel% NEQ 0 (
154152
echo Can't compile TON
155153
exit /b %errorlevel%

tdactor/test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
add_executable(test-coro test-coro.cpp)
22
target_link_libraries(test-coro tdactor tdutils)
33
target_include_directories(test-coro PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../)
4+
5+
ton_test(test-coro)

0 commit comments

Comments
 (0)