-
Notifications
You must be signed in to change notification settings - Fork 16
/
main.go
53 lines (45 loc) · 1.14 KB
/
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
46
47
48
49
50
51
52
53
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)
}
// go func() {
// for {
// time.Sleep(15 * time.Second)
// fmt.Printf("\n\n========\n")
// pprof.Lookup("goroutine").WriteTo(os.Stderr, 1)
// }
// }()
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")
}
}