diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7d435d4 --- /dev/null +++ b/Makefile @@ -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 diff --git a/data/helloworld.c b/data/helloworld.c new file mode 100644 index 0000000..7d69e2d --- /dev/null +++ b/data/helloworld.c @@ -0,0 +1,8 @@ +#include + + +int main(int argc, char *argv[]) { + + fprintf(stdout, "hello world"); + +} diff --git a/ians-notes.txt b/ians-notes.txt index 1864d99..6b96a82 100644 --- a/ians-notes.txt +++ b/ians-notes.txt @@ -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 diff --git a/tests/entry_test.go b/tests/entry_test.go new file mode 100644 index 0000000..0e1cd8b --- /dev/null +++ b/tests/entry_test.go @@ -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") + } +}