Seperate Module and Topdata Pipeline
This commit is contained in:
@@ -429,7 +429,7 @@ printf 'compiled:%s\n' "$(basename "$src")" > "$out"
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildModuleBuildsTopPackageAndInjectsHAKList(t *testing.T) {
|
||||
func TestBuildBuildsTopPackageAndInjectsHAKList(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
mustMkdir(t, filepath.Join(root, "src", "module"))
|
||||
mustMkdir(t, filepath.Join(root, "assets"))
|
||||
@@ -486,9 +486,9 @@ func TestBuildModuleBuildsTopPackageAndInjectsHAKList(t *testing.T) {
|
||||
t.Fatalf("scan: %v", err)
|
||||
}
|
||||
|
||||
result, err := BuildModule(p)
|
||||
result, err := Build(p)
|
||||
if err != nil {
|
||||
t.Fatalf("build module: %v", err)
|
||||
t.Fatalf("build: %v", err)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(root, "build", "sow_top.hak")); err != nil {
|
||||
t.Fatalf("expected sow_top.hak: %v", err)
|
||||
@@ -546,7 +546,7 @@ func TestBuildModuleBuildsTopPackageAndInjectsHAKList(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildModuleCompilesTopDataOnlyOnce(t *testing.T) {
|
||||
func TestBuildModuleDoesNotCompileTopData(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
mustMkdir(t, filepath.Join(root, "src", "module"))
|
||||
mustMkdir(t, filepath.Join(root, "assets"))
|
||||
@@ -609,12 +609,18 @@ func TestBuildModuleCompilesTopDataOnlyOnce(t *testing.T) {
|
||||
}
|
||||
|
||||
joined := strings.Join(progress, "\n")
|
||||
if got := strings.Count(joined, "Building native topdata datasets..."); got != 1 {
|
||||
t.Fatalf("expected exactly one native topdata compile pass, got %d\nprogress:\n%s", got, joined)
|
||||
if got := strings.Count(joined, "Building native topdata datasets..."); got != 0 {
|
||||
t.Fatalf("expected build-module to skip topdata compilation, got %d compile pass(es)\nprogress:\n%s", got, joined)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(root, "build", "sow_top.hak")); !os.IsNotExist(err) {
|
||||
t.Fatalf("expected build-module not to generate sow_top.hak, got err=%v", err)
|
||||
}
|
||||
if _, err := os.Stat(filepath.Join(root, "build", "sow_tlk.tlk")); !os.IsNotExist(err) {
|
||||
t.Fatalf("expected build-module not to generate sow_tlk.tlk, got err=%v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompareFailsWhenTopPackageIsStale(t *testing.T) {
|
||||
func TestCompareIgnoresTopPackageStaleness(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
mustMkdir(t, filepath.Join(root, "src", "module"))
|
||||
mustMkdir(t, filepath.Join(root, "assets"))
|
||||
@@ -677,8 +683,12 @@ func TestCompareFailsWhenTopPackageIsStale(t *testing.T) {
|
||||
if err := os.Chtimes(topdataBase, newTime, newTime); err != nil {
|
||||
t.Fatalf("touch topdata source: %v", err)
|
||||
}
|
||||
if _, err := Compare(p); err == nil {
|
||||
t.Fatalf("expected compare to fail when top package is stale")
|
||||
result, err := Compare(p)
|
||||
if err != nil {
|
||||
t.Fatalf("expected compare to ignore topdata staleness: %v", err)
|
||||
}
|
||||
if result.Checked != 1 {
|
||||
t.Fatalf("expected 1 compared resource, got %d", result.Checked)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user