Skip to content

Commit

Permalink
tests: parse_proc_pid_stat: show details for mismatches
Browse files Browse the repository at this point in the history
Test_parse_proc_pid_stat_Self fails on Amazon linux.
Let's see why.
  • Loading branch information
rfjakob committed Mar 29, 2024
1 parent f0dd004 commit 9b9739e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions testsuite_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,18 @@ func Test_parse_proc_pid_stat_Self(t *testing.T) {
t.Fatal(err)
}

res, out := parse_proc_pid_stat(pid)
_, want := parse_proc_pid_stat(1) // Stupid hack to get a C.pid_stat_t
want.state = _Ctype_char(stat.State[0])
want.ppid = _Ctype_int(stat.Ppid)
want.num_threads = _Ctype_long(stat.NumThreads)

res, have := parse_proc_pid_stat(pid)
if !res {
t.Fatal(res)
}
if byte(out.state) != stat.State[0] {
t.Error()
}
if int64(out.ppid) != stat.Ppid {
t.Error()
}
if int64(out.num_threads) != stat.NumThreads {
t.Error()

if have != want {
t.Errorf("\nhave=%#v\nwant=%#v", have, want)
}
}

Expand Down Expand Up @@ -286,7 +286,7 @@ func Test_parse_proc_pid_stat_Mock(t *testing.T) {
t.Error()
}
if have != want {
t.Errorf("have=%v, want=%v for /proc/100/stat=%q", have, want, c)
t.Errorf("/proc/100/stat=%q:\nhave=%#v\nwant=%#v", have, want, c)
}
}
}
Expand Down

0 comments on commit 9b9739e

Please sign in to comment.