Skip to content

Commit ae2cb21

Browse files
committed
more fix
1 parent 1503b6b commit ae2cb21

File tree

4 files changed

+38
-16
lines changed

4 files changed

+38
-16
lines changed

Diff for: .github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,12 @@ jobs:
160160
if: matrix.test-mode == 'defaults'
161161
run: |
162162
echo "Running redis tests" >> full.log
163-
gotestsum --format short-verbose -- -p 1 -run TestRedis ./arbnode/... ./system_tests/... -coverprofile=coverage-redis.txt -covermode=atomic -coverpkg=./... --test_redis=redis://localhost:6379/0
163+
gotestsum --format short-verbose -- -p 1 -run TestRedis ./arbnode/... ./system_tests/... -coverprofile=coverage-redis.txt -covermode=atomic -coverpkg=./... -- --test_redis=redis://localhost:6379/0
164164
165165
- name: create block input json file
166166
if: matrix.test-mode == 'defaults'
167167
run: |
168-
gotestsum --format short-verbose -- -run TestProgramStorage$ ./system_tests/... --count 1 --recordBlockInputs.WithBaseDir="${{ github.workspace }}/target" --recordBlockInputs.WithTimestampDirEnabled=false --recordBlockInputs.WithBlockIdInFileNameEnabled=false
168+
gotestsum --format short-verbose -- -run TestProgramStorage$ ./system_tests/... --count 1 -- --recordBlockInputs.WithBaseDir="${{ github.workspace }}/target" --recordBlockInputs.WithTimestampDirEnabled=false --recordBlockInputs.WithBlockIdInFileNameEnabled=false
169169
170170
- name: run arbitrator prover on block input json
171171
if: matrix.test-mode == 'defaults'

Diff for: .github/workflows/gotestsum.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ for package in $packages; do
7979
fi
8080

8181
if [ "$test_state_scheme" != "" ]; then
82-
cmd="$cmd --test_state_scheme=$test_state_scheme"
82+
cmd="$cmd -- --test_state_scheme=$test_state_scheme"
8383
fi
8484

8585
cmd="$cmd > >(stdbuf -oL tee -a full.log | grep -vE \"INFO|seal\")"

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ test-go-stylus: test-go-deps
240240

241241
.PHONY: test-go-redis
242242
test-go-redis: test-go-deps
243-
gotestsum --format short-verbose --no-color=false -- -p 1 -run TestRedis ./system_tests/... ./arbnode/... --test_redis=redis://localhost:6379/0
243+
gotestsum --format short-verbose --no-color=false -- -p 1 -run TestRedis ./system_tests/... ./arbnode/... -- --test_redis=redis://localhost:6379/0
244244
@printf $(done)
245245

246246
.PHONY: test-gen-proofs

Diff for: util/testhelpers/flag/flag.go

+34-12
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,41 @@ package testflag
22

33
import (
44
"flag"
5+
"log"
6+
"os"
57
)
68

79
var (
8-
StateSchemeFlag = flag.String("test_state_scheme", "", "State scheme to use for tests")
9-
RedisFlag = flag.String("test_redis", "", "Redis URL for testing")
10-
RecordBlockInputsEnable = flag.Bool("recordBlockInputs.enable", true, "Whether to record block inputs as a json file")
11-
RecordBlockInputsWithSlug = flag.String("recordBlockInputs.WithSlug", "", "Slug directory for validationInputsWriter")
12-
RecordBlockInputsWithBaseDir = flag.String("recordBlockInputs.WithBaseDir", "", "Base directory for validationInputsWriter")
13-
RecordBlockInputsWithTimestampDirEnabled = flag.Bool("recordBlockInputs.WithTimestampDirEnabled", true, "Whether to add timestamp directory while recording block inputs")
14-
RecordBlockInputsWithBlockIdInFileNameEnabled = flag.Bool("recordBlockInputs.WithBlockIdInFileNameEnabled", true, "Whether to record block inputs using test specific block_id")
15-
LogLevelFlag = flag.String("test_loglevel", "", "Log level for tests")
16-
SeedFlag = flag.String("seed", "", "Seed for random number generator")
17-
RunsFlag = flag.String("runs", "", "Number of runs for test")
18-
LoggingFlag = flag.String("logging", "", "Enable logging")
19-
CompileFlag = flag.String("test_compile", "", "[STORE|LOAD] to allow store/load in compile test")
10+
fs = flag.NewFlagSet("test", flag.ExitOnError)
11+
StateSchemeFlag = fs.String("test_state_scheme", "", "State scheme to use for tests")
12+
RedisFlag = fs.String("test_redis", "", "Redis URL for testing")
13+
RecordBlockInputsEnable = fs.Bool("recordBlockInputs.enable", true, "Whether to record block inputs as a json file")
14+
RecordBlockInputsWithSlug = fs.String("recordBlockInputs.WithSlug", "", "Slug directory for validationInputsWriter")
15+
RecordBlockInputsWithBaseDir = fs.String("recordBlockInputs.WithBaseDir", "", "Base directory for validationInputsWriter")
16+
RecordBlockInputsWithTimestampDirEnabled = fs.Bool("recordBlockInputs.WithTimestampDirEnabled", true, "Whether to add timestamp directory while recording block inputs")
17+
RecordBlockInputsWithBlockIdInFileNameEnabled = fs.Bool("recordBlockInputs.WithBlockIdInFileNameEnabled", true, "Whether to record block inputs using test specific block_id")
18+
LogLevelFlag = fs.String("test_loglevel", "", "Log level for tests")
19+
SeedFlag = fs.String("seed", "", "Seed for random number generator")
20+
RunsFlag = fs.String("runs", "", "Number of runs for test")
21+
LoggingFlag = fs.String("logging", "", "Enable logging")
22+
CompileFlag = fs.String("test_compile", "", "[STORE|LOAD] to allow store/load in compile test")
2023
)
24+
25+
// This is a workaround for the fact that we can only pass flags to the package in which they are defined.
26+
// So to avoid doing that we pass the flags after adding a delimiter "--" to the command line.
27+
// We then parse the argument only after the delimiter to the flagset.
28+
func init() {
29+
var args []string
30+
foundDelimiter := false
31+
for _, arg := range os.Args {
32+
if foundDelimiter {
33+
args = append(args, arg)
34+
}
35+
if arg == "--" {
36+
foundDelimiter = true
37+
}
38+
}
39+
if err := fs.Parse(args); err != nil {
40+
log.Fatal(err)
41+
}
42+
}

0 commit comments

Comments
 (0)