Skip to content

Commit

Permalink
revert changes to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
fearful-symmetry committed Sep 18, 2024
1 parent 08648ca commit 5c027da
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions testing/testrunner/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,20 +193,10 @@ func getJsonEventType(jsonLine string) (string, error) {
return jsonUnmarshaled.EventType, nil
}

func runTestCmd(cmdArg []string) []byte {
cmd := exec.Command(cmdArg[0], cmdArg[1:]...)
return handleTestOutput(cmd)
}

func runTestBin(binName string) []byte {
cmd := exec.Command(fmt.Sprintf("/%s", binName))
return handleTestOutput(cmd)

}

func handleTestOutput(cmd *exec.Cmd) []byte {
output, err := cmd.Output()
binName := cmd.Path
if err != nil {
fmt.Printf("===== stderr of %s =====\n", binName)
fmt.Println(err)
Expand All @@ -230,6 +220,12 @@ func AssertPidInfoEqual(tpi TestPidInfo, pi PidInfo) {
AssertInt64Equal(pi.Sid, tpi.Sid)
}

func AssertNotZero(a uint8) {
if a == 0 {
TestFail(fmt.Sprintf("Test assertion failed %d == 0", a))
}
}

func AssertTrue(val bool) {
if !val {
TestFail(fmt.Sprintf("Expected %t to be true", val))
Expand All @@ -248,12 +244,6 @@ func AssertStringsEqual(a, b string) {
}
}

func AssertNotZero(a uint8) {
if a == 0 {
TestFail(fmt.Sprintf("Test assertion failed %d == 0", a))
}
}

func AssertInt64Equal(a, b int64) {
if a != b {
TestFail(fmt.Sprintf("Test assertion failed %d != %d", a, b))
Expand Down Expand Up @@ -361,7 +351,6 @@ func RunTest(f func()) {
func RunEventsTest(f func(*EventsTraceInstance), args ...string) {
testFuncName := runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name()
ctx, cancel := context.WithTimeout(context.TODO(), 90*time.Second)
fmt.Printf("running test: %s\n", testFuncName)

et := NewEventsTrace(ctx, args...)
et.Start(ctx)
Expand Down

0 comments on commit 5c027da

Please sign in to comment.