From e2ffb4fc9111e28f1d8e0e987cb06172cbbd4e84 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 27 Aug 2017 15:08:11 +0200 Subject: pkg/compiler: move more const-processing code to compiler --- pkg/compiler/compiler_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'pkg/compiler/compiler_test.go') diff --git a/pkg/compiler/compiler_test.go b/pkg/compiler/compiler_test.go index e68d97d3e..5415234c6 100644 --- a/pkg/compiler/compiler_test.go +++ b/pkg/compiler/compiler_test.go @@ -4,12 +4,33 @@ package compiler import ( + "path/filepath" "reflect" + "runtime" "testing" "github.com/google/syzkaller/pkg/ast" ) +func TestCompileAll(t *testing.T) { + eh := func(pos ast.Pos, msg string) { + t.Logf("%v:%v:%v: %v", pos.File, pos.Line, pos.Col, msg) + } + desc := ast.ParseGlob(filepath.Join("..", "..", "sys", "*.txt"), eh) + if desc == nil { + t.Fatalf("parsing failed") + } + glob := filepath.Join("..", "..", "sys", "*_"+runtime.GOARCH+".const") + consts := DeserializeConstsGlob(glob, eh) + if consts == nil { + t.Fatalf("reading consts failed") + } + prog := Compile(desc, consts, eh) + if prog == nil { + t.Fatalf("compilation failed") + } +} + func TestExtractConsts(t *testing.T) { desc := ast.Parse([]byte(extractConstsInput), "test", nil) if desc == nil { -- cgit mrf-deployment