-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add parallel execution - add simulation tests
- Loading branch information
ivivanov
committed
Feb 2, 2023
1 parent
9badcef
commit b3f6858
Showing
2 changed files
with
188 additions
and
43 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 |
---|---|---|
@@ -1,50 +1,55 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
COSMOSSDK_DIR=$(go list -m -f '{{.Dir}}' github.com/cosmos/cosmos-sdk) | ||
echo "Cosmos SDK Path: $COSMOSSDK_DIR" | ||
|
||
# Usage: skip_test "$testFoo" "$packageBar" | ||
# Returns TEST_LIST containing all the tests to be executed | ||
# To skip it, we need to: | ||
# 1. Retrieve all the tests in the same package | ||
# 2. Remove the test we want to skip | ||
# 3. Format the list of remaining tests as a regex in the form 'TestName|TestName|...' | ||
# 4. Pass the list of tests to the go test command with the -run flag | ||
# | ||
# | ||
# There is no easier way to skip specific tests with go test currently. | ||
# See: https://github.com/golang/go/issues/41583 | ||
skip_test() { | ||
TEST_LIST="$(go test -list '.*' $2 | | ||
grep -v $1 | | ||
sed '$d' | | ||
sed ':a; /$/N; s/\n/|/; ta')" | ||
grep -v $1 | | ||
sed '$d' | | ||
sed ':a; /$/N; s/\n/|/; ta')" | ||
|
||
if [ -z "$TEST_LIST" ]; then | ||
TEST_LIST="skip all" | ||
fi | ||
} | ||
|
||
if [ -z "$COSMOSSDK_DIR" ]; then | ||
echo "There is no Cosmos SDK" | ||
else | ||
COSMOSSDK_PACKAGES=$(go list $COSMOSSDK_DIR/... | uniq) | ||
# COSMOSSDK_PACKAGES="github.com/cosmos/cosmos-sdk/server github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
for PACKAGE in $COSMOSSDK_PACKAGES; do | ||
TEST_LIST="" | ||
|
||
# Skip the TestInterceptConfigsWithBadPermissions test, as it fails when running the test as the root user | ||
if [ "$PACKAGE" == "github.com/cosmos/cosmos-sdk/server" ]; then | ||
skip_test "TestInterceptConfigsWithBadPermissions" $PACKAGE | ||
fi | ||
|
||
# Skip because TestIntegrationTestSuite/TestBroadcastTx_GRPCGateway/valid_request fails | ||
if [ "$PACKAGE" == "github.com/cosmos/cosmos-sdk/x/auth/tx" ]; then | ||
skip_test "TestIntegrationTestSuite" $PACKAGE | ||
fi | ||
|
||
# skip entire package due to build error | ||
if [ "$PACKAGE" == "github.com/cosmos/cosmos-sdk/server/grpc" ]; then | ||
continue | ||
fi | ||
|
||
echo "go test -mod=readonly -tags='cgo ledger test_ledger_mock norace' -run=$TEST_LIST $PACKAGE" | ||
go test -mod=readonly -tags='cgo ledger test_ledger_mock norace' -run=$TEST_LIST $PACKAGE | ||
done | ||
fi | ||
PKG_LIST=$(cat $1) | ||
|
||
for PACKAGE in $PKG_LIST; do | ||
TEST_LIST="" | ||
|
||
# skip entire package due to build error. Also there are no tests in it | ||
if [ "$PACKAGE" == "github.com/cosmos/cosmos-sdk/server/grpc" ]; then | ||
continue | ||
fi | ||
|
||
# failed to initialize database: open /tmp/Test_runMigrateCmd3518174278/001/keys/keys.db/LOCK: permission denied | ||
if [ "$PACKAGE" == "github.com/cosmos/cosmos-sdk/client/keys" ]; then | ||
skip_test "Test_runMigrateCmd" $PACKAGE | ||
fi | ||
|
||
# failed to initialize database: open /tmp/TestLegacyKeybase2255353028/001/keys/keys.db/LOCK: permission denied | ||
if [ "$PACKAGE" == "github.com/cosmos/cosmos-sdk/crypto/keyring" ]; then | ||
skip_test "TestLegacyKeybase" $PACKAGE | ||
fi | ||
|
||
# Expected nil, but got: &fs.PathError{Op:"open", Path:".touch", Err:0xd} | ||
if [ "$PACKAGE" == "github.com/cosmos/cosmos-sdk/store/streaming" ]; then | ||
skip_test "TestStreamingServiceConstructor" $PACKAGE | ||
fi | ||
|
||
if [ "$TEST_LIST" == "skip all" ]; then | ||
echo "No tests in package: $PACKAGE" | ||
else | ||
go test -mod=readonly -tags='ledger test_ledger_mock' -race -timeout 30m -run=$TEST_LIST $PACKAGE | ||
fi | ||
done |