-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(coverage): Add simple coverage (#2067)
* Add test aggregator to all directories. * Implement coverage script.
- Loading branch information
1 parent
7797b2c
commit d864db3
Showing
15 changed files
with
146 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/sh | ||
|
||
# Check if env.sh has been loaded, or if this file is being ran from it. | ||
# Using NIMC as a proxy for this, as it's defined in the nimbus-build-system's env.sh. | ||
if [ -z "$NIMC" ] | ||
then | ||
echo "[ERROR] This tool can only be ran from the Nimbus environment. Either:" | ||
echo "- Source env.sh 'source /path/to/env.sh', and then run the script directly '/path/to/scripts/run_cov.sh'." | ||
echo "- Run this script as a parameter to env.sh '/path/to/env.sh /path/to/scripts/run_cov.sh'." | ||
exit 1 | ||
fi | ||
|
||
# Check for lcov tool | ||
which lcov 1>/dev/null 2>&1 | ||
if [ $? != 0 ] | ||
then | ||
echo "[ERROR] You need to have lcov installed in order to generate the test coverage report." | ||
exit 2 | ||
fi | ||
|
||
SCRIPT_PATH=$(dirname "$(realpath -s "$0")") | ||
REPO_ROOT=$(dirname $SCRIPT_PATH) | ||
generated_not_to_break_here="$REPO_ROOT/generated_not_to_break_here" | ||
|
||
if [ -f $generated_not_to_break_here ] | ||
then | ||
echo "The file '$generated_not_to_break_here' already exists. Do you want to continue? (y/n)" | ||
read -r response | ||
if [ "$response" != "y" ] | ||
then | ||
exit 3 | ||
fi | ||
fi | ||
|
||
output_directory="$REPO_ROOT/coverage_html_report" | ||
base_filepath="$REPO_ROOT/tests/test_all" | ||
nim_filepath=$base_filepath.nim | ||
info_filepath=$base_filepath.info | ||
|
||
# Workaround a nim bug. See https://github.com/nim-lang/Nim/issues/12376 | ||
touch $generated_not_to_break_here | ||
|
||
# Generate the coverage report | ||
nim --debugger:native --passC:--coverage --passL:--coverage --passL:librln_v0.3.4.a --passL:-lm c $nim_filepath | ||
lcov --base-directory . --directory . --zerocounters -q | ||
$base_filepath | ||
lcov --base-directory . --directory . --include "*/waku/**" --include "*/apps/**" --exclude "*/vendor/**" -c -o $info_filepath | ||
genhtml -o $output_directory $info_filepath | ||
|
||
# Cleanup | ||
rm -rf $info_filepath $base_filepath nimcache | ||
rm $generated_not_to_break_here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
{.used.} | ||
|
||
# Waku common test suite | ||
import | ||
./common/test_envvar_serialization, | ||
./common/test_confutils_envvar, | ||
./common/test_protobuf_validation, | ||
./common/test_enr_builder, | ||
./common/test_sqlite_migrations | ||
import ./common/test_all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
## Wakunode2 | ||
|
||
import | ||
./wakunode2/test_app, | ||
./wakunode2/test_validators | ||
|
||
import ./wakunode2/test_all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import | ||
./test_base64_codec, | ||
./test_confutils_envvar, | ||
./test_enr_builder, | ||
./test_envvar_serialization, | ||
./test_protobuf_validation, | ||
./test_sqlite_migrations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{.used.} | ||
|
||
import | ||
./all_tests_common, | ||
./all_tests_waku, | ||
./all_tests_wakunode2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{.used.} | ||
|
||
import | ||
./test_driver_postgres_query, | ||
./test_driver_postgres, | ||
./test_driver_queue_index, | ||
./test_driver_queue_pagination, | ||
./test_driver_queue_query, | ||
./test_driver_queue, | ||
./test_driver_sqlite_query, | ||
./test_driver_sqlite, | ||
./test_retention_policy, | ||
./test_waku_archive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{.used.} | ||
|
||
import | ||
./test_message_digest, | ||
./test_namespaced_topics, | ||
./test_peers, | ||
./test_published_address, | ||
./test_sharding, | ||
./test_time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{.used.} | ||
|
||
import | ||
./test_waku_client, | ||
./test_waku_filter_protocol, | ||
./test_waku_filter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{.used.} | ||
|
||
import | ||
./test_waku_relay, | ||
./test_wakunode_relay |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{.used.} | ||
|
||
import | ||
./test_rln_group_manager_onchain, | ||
./test_rln_group_manager_static, | ||
./test_waku_rln_relay, | ||
./test_wakunode_rln_relay |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{.used.} | ||
|
||
import | ||
./test_resume, | ||
./test_rpc_codec, | ||
./test_waku_store, | ||
./test_wakunode_store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{.used.} | ||
|
||
import | ||
./test_app, | ||
./test_validators |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{.used.} | ||
|
||
import | ||
./test_jsonrpc_admin, | ||
./test_jsonrpc_debug, | ||
./test_jsonrpc_filter, | ||
./test_jsonrpc_relay, | ||
./test_jsonrpc_store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{.used.} | ||
|
||
import | ||
./test_rest_debug_serdes, | ||
./test_rest_debug, | ||
./test_rest_filter, | ||
./test_rest_health, | ||
./test_rest_legacy_filter, | ||
./test_rest_relay_serdes, | ||
./test_rest_relay, | ||
./test_rest_serdes, | ||
./test_rest_store |