TestExtensions runs extension tests when invoked from Gohan CLI
(context *cli.Context)
| 64 | |
| 65 | // TestExtensions runs extension tests when invoked from Gohan CLI |
| 66 | func TestExtensions(context *cli.Context) { |
| 67 | config := setupConfig(context) |
| 68 | hasExtTypes := context.IsSet("type") |
| 69 | runJsExt := !hasExtTypes |
| 70 | runSoExt := !hasExtTypes |
| 71 | if hasExtTypes { |
| 72 | extTypes := strings.Split(context.String("type"), ",") |
| 73 | for _, t := range extTypes { |
| 74 | switch t { |
| 75 | case "js": |
| 76 | runJsExt = true |
| 77 | case "so": |
| 78 | runSoExt = true |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | if runJsExt { |
| 83 | testFiles := getTestFiles(context.Args(), "js") |
| 84 | if ret := RunTests(testFiles, context.Bool("verbose") || config != nil, context.String("run-test"), context.Int("parallel")); ret != 0 { |
| 85 | os.Exit(ret) |
| 86 | } |
| 87 | } |
| 88 | if runSoExt { |
| 89 | testFiles := getTestFiles(context.Args(), "so") |
| 90 | if err := gorunner.NewTestRunner(testFiles, context.Bool("verbose") || config != nil, context.String("run-test"), context.Int("parallel")).Run(); err != nil { |
| 91 | log.Fatalf("%s", err.Error()) |
| 92 | os.Exit(1) |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | // RunTests runs extension tests for CLI. |
| 98 | func RunTests(testFiles []string, printAllLogs bool, testFilter string, workers int) (returnCode int) { |
nothing calls this directly
no test coverage detected