main (test): remove global build lock
Этот коммит содержится в:
родитель
b7b7713526
коммит
bb08a25edc
1 изменённых файлов: 1 добавлений и 14 удалений
15
main_test.go
15
main_test.go
|
@ -14,7 +14,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -186,18 +185,6 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Due to some problems with LLD, we cannot run links in parallel, or in parallel with compiles.
|
|
||||||
// Therefore, we put a lock around builds and run everything else in parallel.
|
|
||||||
var buildLock sync.Mutex
|
|
||||||
|
|
||||||
// runBuild is a thread-safe wrapper around Build.
|
|
||||||
func runBuild(src, out string, opts *compileopts.Options) error {
|
|
||||||
buildLock.Lock()
|
|
||||||
defer buildLock.Unlock()
|
|
||||||
|
|
||||||
return Build(src, out, opts)
|
|
||||||
}
|
|
||||||
|
|
||||||
func optionsFromTarget(target string) compileopts.Options {
|
func optionsFromTarget(target string) compileopts.Options {
|
||||||
return compileopts.Options{
|
return compileopts.Options{
|
||||||
// GOOS/GOARCH are only used if target == ""
|
// GOOS/GOARCH are only used if target == ""
|
||||||
|
@ -293,7 +280,7 @@ func runTestWithConfig(name string, t *testing.T, options compileopts.Options, c
|
||||||
if spec.GOOS == "windows" {
|
if spec.GOOS == "windows" {
|
||||||
binary += ".exe"
|
binary += ".exe"
|
||||||
}
|
}
|
||||||
err = runBuild("./"+path, binary, &options)
|
err = Build("./"+path, binary, &options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
printCompilerError(t.Log, err)
|
printCompilerError(t.Log, err)
|
||||||
t.Fail()
|
t.Fail()
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче