(t *testing.T)
| 1075 | } |
| 1076 | |
| 1077 | func TestRuntimeEndToEnd(t *testing.T) { |
| 1078 | testutil.SkipIfShort(t) |
| 1079 | if testing.Verbose() { |
| 1080 | testutil.SetFlag(t, "vmodule", "vm=2,loader=2,checker=2") |
| 1081 | } |
| 1082 | for _, tc := range vmTests { |
| 1083 | tc := tc |
| 1084 | t.Run(tc.name, func(t *testing.T) { |
| 1085 | progRuntimeErrorsCheck := testutil.ExpectMapExpvarDeltaWithDeadline(t, "prog_runtime_errors_total", tc.name, tc.errs) |
| 1086 | |
| 1087 | store := metrics.NewStore() |
| 1088 | lines := make(chan *logline.LogLine, 1) |
| 1089 | var wg sync.WaitGroup |
| 1090 | r, err := New(lines, &wg, "", store, ErrorsAbort(), DumpAst(), DumpAstTypes(), DumpBytecode(), OmitMetricSource(), TraceExecution()) |
| 1091 | testutil.FatalIfErr(t, err) |
| 1092 | compileErrors := r.CompileAndRun(tc.name, strings.NewReader(tc.prog)) |
| 1093 | testutil.FatalIfErr(t, compileErrors) |
| 1094 | scanner := bufio.NewScanner(strings.NewReader(tc.log)) |
| 1095 | lineCount := 0 |
| 1096 | for scanner.Scan() { |
| 1097 | lineCount++ |
| 1098 | lines <- logline.New(context.Background(), tc.name, scanner.Text()) |
| 1099 | } |
| 1100 | close(lines) |
| 1101 | wg.Wait() |
| 1102 | |
| 1103 | progRuntimeErrorsCheck() |
| 1104 | |
| 1105 | var ms metrics.MetricSlice |
| 1106 | store.Range(func(m *metrics.Metric) error { |
| 1107 | ms = append(ms, m) |
| 1108 | return nil |
| 1109 | }) |
| 1110 | |
| 1111 | // Ignore the datum.Time field as well, as the results will be unstable otherwise. |
| 1112 | testutil.ExpectNoDiff(t, tc.metrics, ms, testutil.SortSlices(metrics.Less), testutil.IgnoreUnexported(metrics.Metric{}, sync.RWMutex{}, datum.String{}), testutil.IgnoreFields(datum.BaseDatum{}, "Time")) |
| 1113 | }) |
| 1114 | } |
| 1115 | } |
nothing calls this directly
no test coverage detected