File: 02-proc-stat-test-int64.patch

package info (click to toggle)
golang-github-prometheus-procfs 0.8.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, bookworm-proposed-updates, sid
  • size: 1,972 kB
  • sloc: sh: 348; makefile: 20
file content (29 lines) | stat: -rw-r--r-- 1,708 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Description: Reduce the magnitude of test data to fit within 32-bit ints
 Since the ProcStat struct uses int types for CUTime and CSTime, the supplied
 test data will overflow these on 32-bit archs.
Author: Daniel Swarbrick <dswarbrick@debian.org>
Bug: https://github.com/prometheus/procfs/pull/404/files#r963162202
--- a/proc_stat_test.go
+++ b/proc_stat_test.go
@@ -94,8 +94,8 @@ func TestProcStatLimits(t *testing.T) {
 		want int
 		have int
 	}{
-		{name: "waited for children user time", want: math.MinInt64, have: s.CUTime},
-		{name: "waited for children system time", want: math.MaxInt64, have: s.CSTime},
+		{name: "waited for children user time", want: math.MinInt32, have: s.CUTime},
+		{name: "waited for children system time", want: math.MaxInt32, have: s.CSTime},
 	} {
 		if test.want != test.have {
 			t.Errorf("want %s %d, have %d", test.name, test.want, test.have)
--- a/testdata/fixtures.ttar
+++ b/testdata/fixtures.ttar
@@ -709,7 +709,7 @@ SymlinkTo: /does/not/exist
 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Path: fixtures/proc/26232/stat
 Lines: 1
-33 (ata_sff) S 2 0 0 0 -1 69238880 0 0 0 0 0 0 -9223372036854775808 9223372036854775807 0 -20 1 0 5 0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 18446744073709551615 0 0 -9223372036854775808 9223372036854775807 0 0 0 0 0 0 0 0 0 0 0 0 0
+33 (ata_sff) S 2 0 0 0 -1 69238880 0 0 0 0 0 0 -2147483648 2147483647 0 -20 1 0 5 0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 18446744073709551615 0 0 -9223372036854775808 9223372036854775807 0 0 0 0 0 0 0 0 0 0 0 0 0
 Mode: 644
 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Path: fixtures/proc/26232/wchan