diff --git a/test/integration_test.go b/test/integration_test.go index ca67689..96d938e 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -657,7 +657,7 @@ func testImportFlag(t *testing.T) { for name, scopes := range data { for _, metric := range scopes { if metric.Unit.Base != r[name] { - t.Errorf("Metric %s unit: Got %s, want %s", name, metric.Unit, r[name]) + t.Errorf("Metric %s unit: Got %s, want %s", name, metric.Unit.Base, r[name]) } } } diff --git a/tools/sanitize-archive/main.go b/tools/sanitize-archive/main.go index 4b17938..4bcb8a1 100644 --- a/tools/sanitize-archive/main.go +++ b/tools/sanitize-archive/main.go @@ -72,25 +72,28 @@ func deepCopyJobMeta(j *JobMeta) schema.JobMeta { } func deepCopyJobData(d *JobData) schema.JobData { - var dn schema.JobData = make(schema.JobData) + var dn = make(schema.JobData) for k, v := range *d { for mk, mv := range v { var mn schema.JobMetric mn.Unit = units.ConvertUnitString(mv.Unit) mn.Timestep = mv.Timestep - mn.Series = make([]schema.Series, len(mv.Series)) for _, v := range mv.Series { - var id *string = new(string) var sn schema.Series sn.Hostname = v.Hostname - *id = fmt.Sprint(*v.Id) - sn.Id = id - sn.Statistics = schema.MetricStatistics{ - Avg: v.Statistics.Avg, - Min: v.Statistics.Min, - Max: v.Statistics.Max} + if v.Id != nil { + var id = new(string) + *id = fmt.Sprint(*v.Id) + sn.Id = id + } + if v.Statistics != nil { + sn.Statistics = schema.MetricStatistics{ + Avg: v.Statistics.Avg, + Min: v.Statistics.Min, + Max: v.Statistics.Max} + } sn.Data = make([]schema.Float, len(v.Data)) copy(sn.Data, v.Data) @@ -121,7 +124,7 @@ func deepCopyClusterConfig(co *Cluster) schema.Cluster { scn.SocketsPerNode = sco.SocketsPerNode scn.CoresPerSocket = sco.CoresPerSocket scn.ThreadsPerCore = sco.ThreadsPerCore - var prefix *string = new(string) + var prefix = new(string) *prefix = "G" scn.FlopRateScalar = schema.MetricValue{ Unit: schema.Unit{Base: "F/s", Prefix: prefix},