Looking for data races.

This commit is contained in:
Ian A.Mason 2019-10-20 13:42:26 -07:00
parent dd941cd29b
commit 8e330f2e72
4 changed files with 43 additions and 0 deletions

11
Makefile Normal file
View File

@ -0,0 +1,11 @@
install:
go install -race github.com/SRI-CSL/gllvm/cmd/...
race: install
go test -v -race ./tests
clean:
rm -f tests/.helloworld.c.o tests/.helloworld.c.o.bc

8
data/helloworld.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
int main(int argc, char *argv[]) {
fprintf(stdout, "hello world");
}

View File

@ -27,3 +27,7 @@ For keeping up with the Jones:
clang -cc1 --help
https://clang.llvm.org/docs/ClangCommandLineReference.html
For fretting about race conditions:
go build -race cmd

20
tests/entry_test.go Normal file
View File

@ -0,0 +1,20 @@
package test
import (
"github.com/SRI-CSL/gllvm/shared"
"testing"
"fmt"
)
func Test_basic(t *testing.T) {
args := []string{ "../data/helloworld.c", "-o", "../data/hello" }
exitCode := shared.Compile(args, "clang")
if exitCode != 0 {
t.Errorf("Compile of %v returned %v\n", args, exitCode)
} else {
fmt.Println("Compiled OK")
}
}