diff options
author | Jan Mercl <0xjnml@gmail.com> | 2017-07-07 17:45:24 +0200 |
---|---|---|
committer | Jan Mercl <0xjnml@gmail.com> | 2017-07-07 17:45:24 +0200 |
commit | a46bafc8c8bdbf52b6880b4183651971650d0881 (patch) | |
tree | da42e8de90bd590f609784b51ba9dc28c4f6d7ef /generator.go | |
parent | 3f755c812f6e5fbcbf2ffd8c3ec394f1d4a53f13 (diff) |
Partially fix TestThread4.
modified: generator.go
modified: internal/sqlite.org/sqlite-src-3190300/test/threadtest1.c
new file: internal/sqlite.org/sqlite-src-3190300/test/threadtest4.c
modified: internal/threadtest1/threadtest1_linux_amd64.go
modified: internal/threadtest4/threadtest4_linux_amd64.go
modified: z_linux_test.go
Diffstat (limited to 'generator.go')
-rw-r--r-- | generator.go | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/generator.go b/generator.go index 106fe43..e699f47 100644 --- a/generator.go +++ b/generator.go @@ -540,7 +540,7 @@ func threadTest1() { unconvert(dst) } -func threadTest(n int) { +func threadTest2() { repo := findRepo(sqliteRepo) if repo == "" { log.Fatalf("repository not found: %v", sqliteRepo) @@ -549,7 +549,7 @@ func threadTest(n int) { sqlitePth := filepath.Join(repo, "sqlite-amalgamation-"+version) pth := filepath.Join(repo, "sqlite-src-"+version, "test") - tag := fmt.Sprintf("threadtest%v", n) + tag := "threadtest2" test := filepath.Join(pth, tag+".c") _, src := build( defines, @@ -633,6 +633,50 @@ func threadTest3() { unconvert(dst) } +func threadTest4() { + repo := findRepo(sqliteRepo) + if repo == "" { + log.Fatalf("repository not found: %v", sqliteRepo) + return + } + + sqlitePth := filepath.Join(repo, "sqlite-amalgamation-"+version) + tag := "threadtest4" + test := filepath.Join("internal", "sqlite.org", "sqlite-src-3190300", "test", "threadtest4.c") + _, src := build( + defines, + [][]string{ + {filepath.Join(sqlitePth, "sqlite3.c")}, + {test}, + }, + []string{"bin"}, + cc.EnableAnonymousStructFields(), + cc.IncludePaths([]string{".", sqlitePth, filepath.Join(repo, "sqlite-src-"+version, "src")}), + ) + + var b bytes.Buffer + fmt.Fprintf(&b, prologueTest, tidyComments(header(test))) + b.Write(src) + b2, err := format.Source(b.Bytes()) + if err != nil { + b2 = b.Bytes() + } + if err := os.MkdirAll(filepath.Join("internal", tag), 0775); err != nil { + log.Fatal(err) + } + + if err := os.MkdirAll(filepath.Join("testdata", tag), 0775); err != nil { + log.Fatal(err) + } + + dst := fmt.Sprintf(filepath.Join("internal", tag, tag+"_%s_%s.go"), runtime.GOOS, runtime.GOARCH) + if err := ioutil.WriteFile(dst, b2, 0664); err != nil { + log.Fatal(err) + } + + unconvert(dst) +} + func main() { log.SetFlags(log.Lshortfile | log.Lmicroseconds) var err error @@ -645,7 +689,7 @@ func main() { sqlite() mpTest() threadTest1() - threadTest(2) + threadTest2() threadTest3() - threadTest(4) + threadTest4() } |