-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtestall.go
75 lines (68 loc) · 1.6 KB
/
testall.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* TESTING STATUS
Working:
container/ring
unicode/utf8
Part-Working:
math - all_test.go : TestExp() and TestExp2()
*/
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
"sync"
)
func main() {
results := make(chan []byte, 100)
done := make(chan bool)
go func() {
for ln := range results {
fmt.Println(string(ln))
}
done <- true
}()
wg := sync.WaitGroup{}
base, err := os.Getwd()
if err == nil {
for _, dir := range []string{"gobyexample", "haxe-call-examples"} {
subdir := base + string(os.PathSeparator) + dir
fds, err := ioutil.ReadDir(subdir)
if err == nil {
for _, fd := range fds {
if fd.IsDir() {
subsubdir := subdir + string(os.PathSeparator) + fd.Name()
gfs, err := ioutil.ReadDir(subsubdir)
if err == nil {
for _, gf := range gfs {
if strings.HasSuffix(gf.Name(), ".go") {
wg.Add(1)
go func(path, fn string) {
if os.Chdir(path) == nil {
out, err := exec.Command("tardisgo", "-debug", "-testall", fn).CombinedOutput()
if err != nil {
out = append(out, []byte("\nexec.Command() error for: ")...)
out = append(out, []byte(path)...)
out = append(out, []byte(string(os.PathSeparator))...)
out = append(out, []byte(fn)...)
out = append(out, []byte("\n-->")...)
out = append(out, []byte(err.Error())...)
}
results <- out
}
wg.Done()
}(subsubdir, gf.Name())
break
}
}
}
}
}
}
}
}
wg.Wait()
close(results)
<-done
}