forked from instructure/straitjacket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (38 loc) · 1003 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"flag"
"fmt"
"straitjacket/engine"
)
func main() {
var flagRunLanguageTests = flag.Bool("test", false, "Run the language sanity tests")
var testLanguage = flag.String("lang", "", "Run the tests for one specific language")
var disableApparmor = flag.Bool("disable-apparmor", false, "Disable all apparmor usage. NOT FOR PROD obv.")
flag.Parse()
if *disableApparmor {
fmt.Printf("Running without apparmor support!\n")
}
engine, err := engine.New("config", *disableApparmor)
if err != nil {
panic(err)
}
if *flagRunLanguageTests {
runLanguageTests(engine, *testLanguage)
} else {
startServer(engine, ":8081")
}
}
func runLanguageTests(engine *engine.Engine, langToRun string) {
for _, lang := range engine.Languages() {
if langToRun == "" || langToRun == lang.Name {
fmt.Printf("Testing %s\n", lang.VisibleName)
err := lang.RunChecks()
if err != nil {
panic(err)
}
}
}
if langToRun == "" {
fmt.Printf("All languages A-OK\n")
}
}