(t *testing.T)
| 160 | } |
| 161 | |
| 162 | func TestWritebackRateDebug(t *testing.T) { |
| 163 | var want = WritebackRateDebugStats{ |
| 164 | Rate: 1765376, |
| 165 | Dirty: 21789409280, |
| 166 | Target: 21894266880, |
| 167 | Proportional: -1124, |
| 168 | Integral: -257624, |
| 169 | Change: 2648, |
| 170 | NextIO: -150773, |
| 171 | } |
| 172 | var ( |
| 173 | in string |
| 174 | gotErr error |
| 175 | got WritebackRateDebugStats |
| 176 | ) |
| 177 | in = "rate: 1.7M/sec" |
| 178 | gotErr = parseWritebackRateDebug(in, &got) |
| 179 | if gotErr != nil || got.Rate != want.Rate { |
| 180 | t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.Rate, got.Rate) |
| 181 | } |
| 182 | |
| 183 | in = "dirty: 20.3G" |
| 184 | gotErr = parseWritebackRateDebug(in, &got) |
| 185 | if gotErr != nil || got.Dirty != want.Dirty { |
| 186 | t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.Dirty, got.Dirty) |
| 187 | } |
| 188 | |
| 189 | in = "target: 20.4G" |
| 190 | gotErr = parseWritebackRateDebug(in, &got) |
| 191 | if gotErr != nil || got.Target != want.Target { |
| 192 | t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.Target, got.Target) |
| 193 | } |
| 194 | |
| 195 | in = "proportional: -1.1k" |
| 196 | gotErr = parseWritebackRateDebug(in, &got) |
| 197 | if gotErr != nil || got.Proportional != want.Proportional { |
| 198 | t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.Proportional, got.Proportional) |
| 199 | } |
| 200 | |
| 201 | in = "integral: -251.6k" |
| 202 | gotErr = parseWritebackRateDebug(in, &got) |
| 203 | if gotErr != nil || got.Integral != want.Integral { |
| 204 | t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.Integral, got.Integral) |
| 205 | } |
| 206 | |
| 207 | in = "change: 2.6k/sec" |
| 208 | gotErr = parseWritebackRateDebug(in, &got) |
| 209 | if gotErr != nil || got.Change != want.Change { |
| 210 | t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.Change, got.Change) |
| 211 | } |
| 212 | |
| 213 | in = "next io: -150773ms" |
| 214 | gotErr = parseWritebackRateDebug(in, &got) |
| 215 | if gotErr != nil || got.NextIO != want.NextIO { |
| 216 | t.Errorf("parsePriorityStats: '%s', want %d, got %d", in, want.NextIO, got.NextIO) |
| 217 | } |
| 218 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…