Fix unit tests

This commit is contained in:
Jan Eitzinger 2023-03-22 07:05:41 +01:00
parent 5d526e1168
commit a168efa8c8
5 changed files with 88 additions and 15 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@
/web/frontend/public/build /web/frontend/public/build
/web/frontend/node_modules /web/frontend/node_modules
.vscode/settings.json .vscode/settings.json
sanitize-archive

View File

@ -141,7 +141,7 @@ func TestLoadCluster(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if cfg.SubClusters[0].CoresPerSocket != 10 { if cfg.SubClusters[0].CoresPerSocket != 4 {
t.Fail() t.Fail()
} }
} }

View File

@ -45,9 +45,29 @@ func TestValidateCluster(t *testing.T) {
"socketsPerNode": 2, "socketsPerNode": 2,
"coresPerSocket": 10, "coresPerSocket": 10,
"threadsPerCore": 2, "threadsPerCore": 2,
"flopRateScalar": 44, "flopRateScalar": {
"flopRateSimd": 704, "unit": {
"memoryBandwidth": 80, "prefix": "G",
"base": "F/s"
},
"value": 14
},
"flopRateSimd": {
"unit": {
"prefix": "G",
"base": "F/s"
},
"value": 112
},
"memoryBandwidth": {
"unit": {
"prefix": "G",
"base": "B/s"
},
"value": 24
},
"numberOfNodes": 70,
"nodes": "w11[27-45,49-63,69-72]",
"topology": { "topology": {
"node": [0,20,1,21,2,22,3,23,4,24,5,25,6,26,7,27,8,28,9,29,10,30,11,31,12,32,13,33,14,34,15,35,16,36,17,37,18,38,19,39], "node": [0,20,1,21,2,22,3,23,4,24,5,25,6,26,7,27,8,28,9,29,10,30,11,31,12,32,13,33,14,34,15,35,16,36,17,37,18,38,19,39],
"socket": [ "socket": [
@ -69,7 +89,12 @@ func TestValidateCluster(t *testing.T) {
"name": "cpu_load", "name": "cpu_load",
"scope": "hwthread", "scope": "hwthread",
"unit": {"base": "load"}, "unit": {"base": "load"},
"timestep": 60 "aggregation": "avg",
"timestep": 60,
"peak": 4,
"normal": 2,
"caution": 1,
"alert": 0.25
} }
] ]
}`) }`)

View File

@ -251,8 +251,8 @@ func TestNormalizeValueNoPrefix(t *testing.T) {
if v != 104.00 { if v != 104.00 {
t.Errorf("Failed ConvertValue: Want 104.00, Got %f", v) t.Errorf("Failed ConvertValue: Want 104.00, Got %f", v)
} }
if s != "MFlops/s" { if s != "MF/s" {
t.Errorf("Failed Prefix or unit: Want GB/s, Got %s", s) t.Errorf("Failed Prefix or unit: Want MF/s, Got %s", s)
} }
} }

View File

@ -69,9 +69,28 @@ func setup(t *testing.T) *api.RestApi {
"socketsPerNode": 1, "socketsPerNode": 1,
"coresPerSocket": 4, "coresPerSocket": 4,
"threadsPerCore": 2, "threadsPerCore": 2,
"flopRateScalar": 44, "flopRateScalar": {
"flopRateSimd": 704, "unit": {
"memoryBandwidth": 80, "prefix": "G",
"base": "F/s"
},
"value": 14
},
"flopRateSimd": {
"unit": {
"prefix": "G",
"base": "F/s"
},
"value": 112
},
"memoryBandwidth": {
"unit": {
"prefix": "G",
"base": "B/s"
},
"value": 24
},
"numberOfNodes": 70,
"topology": { "topology": {
"node": [0, 1, 2, 3, 4, 5, 6, 7], "node": [0, 1, 2, 3, 4, 5, 6, 7],
"socket": [[0, 1, 2, 3, 4, 5, 6, 7]], "socket": [[0, 1, 2, 3, 4, 5, 6, 7]],
@ -87,6 +106,7 @@ func setup(t *testing.T) *api.RestApi {
"unit": { "base": "load"}, "unit": { "base": "load"},
"scope": "node", "scope": "node",
"timestep": 60, "timestep": 60,
"aggregation": "avg",
"peak": 8, "peak": 8,
"normal": 0, "normal": 0,
"caution": 0, "caution": 0,
@ -103,10 +123,30 @@ func setup(t *testing.T) *api.RestApi {
"processorType": "Intel Haswell", "processorType": "Intel Haswell",
"socketsPerNode": 2, "socketsPerNode": 2,
"coresPerSocket": 12, "coresPerSocket": 12,
"threadsPerCore": 1, "threadsPerCore": 1,
"flopRateScalar": 32, "flopRateScalar": {
"flopRateSimd": 512, "unit": {
"memoryBandwidth": 60, "prefix": "G",
"base": "F/s"
},
"value": 14
},
"flopRateSimd": {
"unit": {
"prefix": "G",
"base": "F/s"
},
"value": 112
},
"memoryBandwidth": {
"unit": {
"prefix": "G",
"base": "B/s"
},
"value": 24
},
"numberOfNodes": 70,
"nodes": "w11[27-45,49-63,69-72]",
"topology": { "topology": {
"node": [ 0, 1 ], "node": [ 0, 1 ],
"socket": [ "socket": [
@ -126,6 +166,7 @@ func setup(t *testing.T) *api.RestApi {
"name": "cpu_used", "name": "cpu_used",
"scope": "core", "scope": "core",
"unit": {"base": ""}, "unit": {"base": ""},
"aggregation": "avg",
"timestep": 30, "timestep": 30,
"subClusters": [ "subClusters": [
{ {
@ -141,6 +182,7 @@ func setup(t *testing.T) *api.RestApi {
"name": "ipc", "name": "ipc",
"scope": "core", "scope": "core",
"unit": { "base": "IPC"}, "unit": { "base": "IPC"},
"aggregation": "avg",
"timestep": 60, "timestep": 60,
"subClusters": [ "subClusters": [
{ {
@ -156,6 +198,7 @@ func setup(t *testing.T) *api.RestApi {
"name": "flops_any", "name": "flops_any",
"scope": "core", "scope": "core",
"unit": { "base": "F/s"}, "unit": { "base": "F/s"},
"aggregation": "sum",
"timestep": 60, "timestep": 60,
"subClusters": [ "subClusters": [
{ {
@ -171,6 +214,7 @@ func setup(t *testing.T) *api.RestApi {
"name": "mem_bw", "name": "mem_bw",
"scope": "socket", "scope": "socket",
"unit": { "base": "B/s"}, "unit": { "base": "B/s"},
"aggregation": "sum",
"timestep": 60, "timestep": 60,
"subClusters": [ "subClusters": [
{ {
@ -186,6 +230,7 @@ func setup(t *testing.T) *api.RestApi {
"name": "file_bw", "name": "file_bw",
"scope": "node", "scope": "node",
"unit": { "base": "B/s"}, "unit": { "base": "B/s"},
"aggregation": "sum",
"timestep": 30, "timestep": 30,
"subClusters": [ "subClusters": [
{ {
@ -216,6 +261,7 @@ func setup(t *testing.T) *api.RestApi {
"name": "mem_used", "name": "mem_used",
"scope": "node", "scope": "node",
"unit": {"base": "B"}, "unit": {"base": "B"},
"aggregation": "sum",
"timestep": 30, "timestep": 30,
"subClusters": [ "subClusters": [
{ {
@ -231,6 +277,7 @@ func setup(t *testing.T) *api.RestApi {
"name": "cpu_power", "name": "cpu_power",
"scope": "socket", "scope": "socket",
"unit": {"base": "W"}, "unit": {"base": "W"},
"aggregation": "sum",
"timestep": 60, "timestep": 60,
"subClusters": [ "subClusters": [
{ {
@ -605,7 +652,7 @@ func testImportFlag(t *testing.T) {
r := map[string]string{"mem_used": "GB", "net_bw": "KB/s", r := map[string]string{"mem_used": "GB", "net_bw": "KB/s",
"cpu_power": "W", "cpu_used": "", "cpu_power": "W", "cpu_used": "",
"file_bw": "KB/s", "flops_any": "Flops/s", "file_bw": "KB/s", "flops_any": "F/s",
"mem_bw": "GB/s", "ipc": "IPC"} "mem_bw": "GB/s", "ipc": "IPC"}
for name, scopes := range data { for name, scopes := range data {