Skip to content

Add early exit on cmd failure#50

Open
heppu wants to merge 2 commits into
mainfrom
early-exit
Open

Add early exit on cmd failure#50
heppu wants to merge 2 commits into
mainfrom
early-exit

Conversation

@heppu

@heppu heppu commented Jun 24, 2025

Copy link
Copy Markdown
Contributor

No description provided.

@codecov

codecov Bot commented Jun 24, 2025

Copy link
Copy Markdown

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
50 5 45 0
View the top 3 failed test(s) by shortest run time
github.com/go-tstr/tstr/dep/cmd::TestCmd/ReadyTimeoutExceeded
Stack Traces | 0s run time
=== RUN   TestCmd/ReadyTimeoutExceeded
==================
WARNING: DATA RACE
Write at 0x00c0000b0828 by goroutine 24:
  os/exec.(*Cmd).Wait()
      .../hostedtoolcache/go/1.24.1.../os/exec/exec.go:926 +0x1aa
  github..../tstr/dep/cmd_test.TestCmd.New.StopWithSignal.func62()
      .../dep/cmd/cmd.go:334 +0x151
  github..../tstr/dep/cmd.(*Cmd).Stop()
      .../dep/cmd/cmd.go:102 +0xbc
  github.com/go-tstr/tstr.(*Runner).Stop()
      .../tstr/tstr/runner.go:54 +0xcb
  github.com/go-tstr/tstr.(*Tester).Run()
      .../tstr/tstr/tester.go:108 +0x124
  github.com/go-tstr/tstr.Run()
      .../tstr/tstr/tester.go:47 +0xf5
  github..../tstr/dep/deptest.ErrorIs()
      .../dep/deptest/dep.go:12 +0x26d
  github..../tstr/dep/cmd_test.TestCmd.func4()
      .../dep/cmd/cmd_test.go:155 +0x4b
  testing.tRunner()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1792 +0x225
  testing.(*T).Run.gowrap1()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1851 +0x44

Previous read at 0x00c0000b0828 by goroutine 26:
  github..../tstr/dep/cmd.(*Cmd).Ready.func2()
      .../dep/cmd/cmd.go:79 +0xb2

Goroutine 24 (running) created at:
  testing.(*T).Run()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1851 +0x8f2
  github..../tstr/dep/cmd_test.TestCmd()
      .../dep/cmd/cmd_test.go:154 +0x5924
  testing.tRunner()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1792 +0x225
  testing.(*T).Run.gowrap1()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1851 +0x44

Goroutine 26 (finished) created at:
  github..../tstr/dep/cmd.(*Cmd).Ready()
      .../dep/cmd/cmd.go:77 +0x349
  github.com/go-tstr/tstr.(*Runner).Start()
      .../tstr/tstr/runner.go:43 +0x23a
  github.com/go-tstr/tstr.(*Tester).Run()
      .../tstr/tstr/tester.go:107 +0xfb
  github.com/go-tstr/tstr.Run()
      .../tstr/tstr/tester.go:47 +0xf5
  github..../tstr/dep/deptest.ErrorIs()
      .../dep/deptest/dep.go:12 +0x26d
  github..../tstr/dep/cmd_test.TestCmd.func4()
      .../dep/cmd/cmd_test.go:155 +0x4b
  testing.tRunner()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1792 +0x225
  testing.(*T).Run.gowrap1()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1851 +0x44
==================
    testing.go:1490: race detected during execution of test
--- FAIL: TestCmd/ReadyTimeoutExceeded (0.00s)
github.com/go-tstr/tstr/dep/cmd::TestCmd/WaitForExit
Stack Traces | 0s run time
=== RUN   TestCmd/WaitForExit
go version go1.24.1 linux/amd64
==================
WARNING: DATA RACE
Write at 0x00c0000b0528 by goroutine 16:
  os/exec.(*Cmd).Wait()
      .../hostedtoolcache/go/1.24.1.../os/exec/exec.go:926 +0x1aa
  github..../tstr/dep/cmd_test.TestCmd.WithWaitExit.func12.1()
      .../dep/cmd/cmd.go:247 +0x37
  github..../tstr/dep/cmd.(*Cmd).Ready.func1()
      .../dep/cmd/cmd.go:73 +0x109

Previous read at 0x00c0000b0528 by goroutine 17:
  github..../tstr/dep/cmd.(*Cmd).Ready.func2()
      .../dep/cmd/cmd.go:79 +0xb2

Goroutine 16 (running) created at:
  github..../tstr/dep/cmd.(*Cmd).Ready()
      .../dep/cmd/cmd.go:71 +0x213
  github.com/go-tstr/tstr.(*Runner).Start()
      .../tstr/tstr/runner.go:43 +0x23a
  github.com/go-tstr/tstr.(*Tester).Run()
      .../tstr/tstr/tester.go:107 +0xfb
  github.com/go-tstr/tstr.Run()
      .../tstr/tstr/tester.go:47 +0xf5
  github..../tstr/dep/deptest.ErrorIs()
      .../dep/deptest/dep.go:12 +0x26d
  github..../tstr/dep/cmd_test.TestCmd.func4()
      .../dep/cmd/cmd_test.go:155 +0x4b
  testing.tRunner()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1792 +0x225
  testing.(*T).Run.gowrap1()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1851 +0x44

Goroutine 17 (running) created at:
  github..../tstr/dep/cmd.(*Cmd).Ready()
      .../dep/cmd/cmd.go:77 +0x349
  github.com/go-tstr/tstr.(*Runner).Start()
      .../tstr/tstr/runner.go:43 +0x23a
  github.com/go-tstr/tstr.(*Tester).Run()
      .../tstr/tstr/tester.go:107 +0xfb
  github.com/go-tstr/tstr.Run()
      .../tstr/tstr/tester.go:47 +0xf5
  github..../tstr/dep/deptest.ErrorIs()
      .../dep/deptest/dep.go:12 +0x26d
  github..../tstr/dep/cmd_test.TestCmd.func4()
      .../dep/cmd/cmd_test.go:155 +0x4b
  testing.tRunner()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1792 +0x225
  testing.(*T).Run.gowrap1()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1851 +0x44
==================
    testing.go:1490: race detected during execution of test
--- FAIL: TestCmd/WaitForExit (0.00s)
github.com/go-tstr/tstr/dep/cmd::TestCmd/WaitForExitError
Stack Traces | 0.01s run time
=== RUN   TestCmd/WaitForExitError
go foo: unknown command
Run 'go help' for usage.
stat .../non/existing/pkg: directory not found
==================
WARNING: DATA RACE
Write at 0x00c0000b03a8 by goroutine 13:
  os/exec.(*Cmd).Wait()
      .../hostedtoolcache/go/1.24.1.../os/exec/exec.go:926 +0x1aa
  github..../tstr/dep/cmd_test.TestCmd.WithWaitExit.func9.1()
      .../dep/cmd/cmd.go:247 +0x37
  github..../tstr/dep/cmd.(*Cmd).Ready.func1()
      .../dep/cmd/cmd.go:73 +0x109

Previous read at 0x00c0000b03a8 by goroutine 14:
  github..../tstr/dep/cmd.(*Cmd).Ready.func2()
      .../dep/cmd/cmd.go:79 +0xb2

Goroutine 13 (running) created at:
  github..../tstr/dep/cmd.(*Cmd).Ready()
      .../dep/cmd/cmd.go:71 +0x213
  github.com/go-tstr/tstr.(*Runner).Start()
      .../tstr/tstr/runner.go:43 +0x23a
  github.com/go-tstr/tstr.(*Tester).Run()
      .../tstr/tstr/tester.go:107 +0xfb
  github.com/go-tstr/tstr.Run()
      .../tstr/tstr/tester.go:47 +0xf5
  github..../tstr/dep/deptest.ErrorIs()
      .../dep/deptest/dep.go:12 +0x26d
  github..../tstr/dep/cmd_test.TestCmd.func4()
      .../dep/cmd/cmd_test.go:155 +0x4b
  testing.tRunner()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1792 +0x225
  testing.(*T).Run.gowrap1()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1851 +0x44

Goroutine 14 (running) created at:
  github..../tstr/dep/cmd.(*Cmd).Ready()
      .../dep/cmd/cmd.go:77 +0x349
  github.com/go-tstr/tstr.(*Runner).Start()
      .../tstr/tstr/runner.go:43 +0x23a
  github.com/go-tstr/tstr.(*Tester).Run()
      .../tstr/tstr/tester.go:107 +0xfb
  github.com/go-tstr/tstr.Run()
      .../tstr/tstr/tester.go:47 +0xf5
  github..../tstr/dep/deptest.ErrorIs()
      .../dep/deptest/dep.go:12 +0x26d
  github..../tstr/dep/cmd_test.TestCmd.func4()
      .../dep/cmd/cmd_test.go:155 +0x4b
  testing.tRunner()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1792 +0x225
  testing.(*T).Run.gowrap1()
      .../hostedtoolcache/go/1.24.1.../src/testing/testing.go:1851 +0x44
==================
    testing.go:1490: race detected during execution of test
--- FAIL: TestCmd/WaitForExitError (0.01s)

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant