aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-07-08 14:19:17 +0900
committerOphestra <cat@gensokyo.uk>2026-07-08 14:19:17 +0900
commit3c6e9b3d0526a9338dc897a8e288647b2ec12b10 (patch)
tree11116bbe25971f9e29de627857b599974132f8a3
parentaa5e77ef277d5cb144e4841f3c1ab41282faac01 (diff)
internal/pkg: expose cure whence
Useful for cure determinism validation of KindExec. Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--internal/pkg/archive_test.go2
-rw-r--r--internal/pkg/compress_test.go4
-rw-r--r--internal/pkg/exec_test.go20
-rw-r--r--internal/pkg/file_test.go2
-rw-r--r--internal/pkg/pkg.go69
-rw-r--r--internal/pkg/pkg_test.go91
-rw-r--r--internal/pkg/tar_test.go10
7 files changed, 128 insertions, 70 deletions
diff --git a/internal/pkg/archive_test.go b/internal/pkg/archive_test.go
index 29383eda..239965fd 100644
--- a/internal/pkg/archive_test.go
+++ b/internal/pkg/archive_test.go
@@ -186,7 +186,7 @@ func TestArchiveArtifact(t *testing.T) {
cureMany(t, c, []cureStep{
{"sample", pkg.NewArchive(
pkg.NewFile("", buf.Bytes()),
- ), ignorePathname, expectsFS(want), nil},
+ ), ignorePathname, expectsFS(want), pkg.WNew, nil},
})
}, expectsFS{
".": {Mode: fs.ModeDir | 0700},
diff --git a/internal/pkg/compress_test.go b/internal/pkg/compress_test.go
index 5b542dce..e5e865a4 100644
--- a/internal/pkg/compress_test.go
+++ b/internal/pkg/compress_test.go
@@ -43,7 +43,7 @@ func TestDecompress(t *testing.T) {
&client,
"file:///testdata",
pkg.Checksum{0xfd},
- ), pkg.Gzip), nil, nil, &pkg.ChecksumMismatchError{
+ ), pkg.Gzip), nil, nil, pkg.WNew, &pkg.ChecksumMismatchError{
Got: testdataChecksum,
Want: pkg.Checksum{0xfd},
}},
@@ -52,7 +52,7 @@ func TestDecompress(t *testing.T) {
&client,
"file:///testdata",
testdataChecksum,
- ), pkg.Gzip), ignorePathname, expectsChecksum(sha512.Sum384([]byte{0})), nil},
+ ), pkg.Gzip), ignorePathname, expectsChecksum(sha512.Sum384([]byte{0})), pkg.WNew, nil},
})
}, expectsFS{
".": {Mode: fs.ModeDir | 0700},
diff --git a/internal/pkg/exec_test.go b/internal/pkg/exec_test.go
index b638d4df..884074f4 100644
--- a/internal/pkg/exec_test.go
+++ b/internal/pkg/exec_test.go
@@ -84,7 +84,7 @@ func TestExec(t *testing.T) {
},
}),
pkg.MustPath("/opt", false, testtool),
- ), ignorePathname, wantOffline, nil},
+ ), ignorePathname, wantOffline, pkg.WNew, nil},
{"substitution", pkg.NewExec(
"exec-offline", "", new(wantOffline.hash()), 0, false, false,
@@ -108,7 +108,7 @@ func TestExec(t *testing.T) {
},
}),
pkg.MustPath("/opt", false, testtool),
- ), ignorePathname, wantOffline, nil},
+ ), ignorePathname, wantOffline, pkg.WSubstitute, nil},
{"error passthrough", pkg.NewExec(
"", "", nil, 0, false, true,
@@ -118,7 +118,7 @@ func TestExec(t *testing.T) {
[]string{"testtool"},
pkg.MustPath("/proc/nonexistent", false, failingArtifact),
- ), nil, nil, &pkg.DependencyCureError{
+ ), nil, nil, pkg.WNew, &pkg.DependencyCureError{
{
A: failingArtifact,
Err: stub.UniqueError(0xcafe),
@@ -133,7 +133,7 @@ func TestExec(t *testing.T) {
[]string{"testtool"},
pkg.ExecPath{},
- ), nil, nil, pkg.ErrInvalidPaths},
+ ), nil, nil, pkg.WNew, pkg.ErrInvalidPaths},
})
// check init failure passthrough
@@ -225,7 +225,7 @@ func TestExec(t *testing.T) {
},
}),
pkg.MustPath("/opt", false, testtool),
- ), ignorePathname, wantNet, nil},
+ ), ignorePathname, wantNet, pkg.WNew, nil},
})
destroyStatus(t, base, 2, 0)
@@ -269,7 +269,7 @@ func TestExec(t *testing.T) {
},
}),
pkg.MustPath("/opt", false, testtool),
- ), ignorePathname, wantOffline, nil},
+ ), ignorePathname, wantOffline, pkg.WNew, nil},
})
destroyStatus(t, base, 2, 0)
@@ -316,7 +316,7 @@ func TestExec(t *testing.T) {
return os.MkdirAll(t.GetWorkDir().String(), 0700)
},
}), pkg.Path(pkg.AbsWork, false /* ignored */, testtool),
- ), ignorePathname, wantOffline, nil},
+ ), ignorePathname, wantOffline, pkg.WNew, nil},
})
destroyStatus(t, base, 2, 0)
@@ -385,7 +385,7 @@ func TestExec(t *testing.T) {
},
}),
pkg.MustPath("/opt", false, testtool),
- ), ignorePathname, wantOffline, nil},
+ ), ignorePathname, wantOffline, pkg.WNew, nil},
})
destroyStatus(t, base, 2, 0)
@@ -438,7 +438,7 @@ func TestExec(t *testing.T) {
},
}),
pkg.MustPath("/opt", false, testtool),
- ), ignorePathname, wantOffline, nil},
+ ), ignorePathname, wantOffline, pkg.WNew, nil},
})
destroyStatus(t, base, 2, 0)
@@ -503,7 +503,7 @@ func TestExec(t *testing.T) {
".": {Mode: fs.ModeDir | 0500},
"check": {Mode: 0400, Data: []byte("binfmt")},
- }, nil},
+ }, pkg.WNew, nil},
})
destroyStatus(t, base, 2, 0)
diff --git a/internal/pkg/file_test.go b/internal/pkg/file_test.go
index 9b326453..7884c406 100644
--- a/internal/pkg/file_test.go
+++ b/internal/pkg/file_test.go
@@ -18,7 +18,7 @@ func TestFile(t *testing.T) {
{"short", pkg.NewFile("null", []byte{0}), base.Append(
"identifier",
"3376ALA7hIUm2LbzH2fDvRezgzod1eTK_G6XjyOgbM2u-6swvkFaF0BOwSl_juBi",
- ), want, nil},
+ ), want, pkg.WNew, nil},
})
}, expectsFS{
".": {Mode: fs.ModeDir | 0700},
diff --git a/internal/pkg/pkg.go b/internal/pkg/pkg.go
index aadfa308..9d32231d 100644
--- a/internal/pkg/pkg.go
+++ b/internal/pkg/pkg.go
@@ -303,7 +303,7 @@ func (c *common) Open(a Artifact) (r io.ReadCloser, err error) {
}
var pathname *check.Absolute
- if pathname, _, err = c.cache.cure(a, true); err != nil {
+ if pathname, _, _, err = c.cache.cure(a, true); err != nil {
return
}
@@ -356,12 +356,12 @@ func (f *FContext) linkSubstitute(ids, substitutes string) (err error) {
return
}
-// InvalidLookupError is the identifier of non-dependency [Artifact] looked up
+// InvalidLookupError is the identifier of non-input [Artifact] looked up
// via [FContext.GetArtifact] by a misbehaving [Artifact] implementation.
type InvalidLookupError ID
func (e InvalidLookupError) Error() string {
- return "attempting to look up non-dependency artifact " + Encode(e)
+ return "attempting to look up non-input artifact " + Encode(e)
}
var _ error = InvalidLookupError{}
@@ -602,7 +602,7 @@ type cureRes struct {
checksum unique.Handle[Checksum]
}
-// A pendingArtifactDep is a dependency [Artifact] pending concurrent curing,
+// A pendingArtifactDep is an input [Artifact] pending concurrent curing,
// subject to the cures limit. Values pointed to by result addresses are safe
// to access after the [sync.WaitGroup] associated with this pendingArtifactDep
// is done. pendingArtifactDep must not be reused or modified after it is sent
@@ -676,7 +676,7 @@ const (
// suppressed regardless of [message.Msg] state.
CSuppressInit
- // CIgnoreSubstitutes disables content-based dependency substitution.
+ // CIgnoreSubstitutes disables content-based input substitution.
CIgnoreSubstitutes
// CExternShallow arranges for only non-flood inputs to be fetched when
@@ -733,7 +733,7 @@ type Cache struct {
parent context.Context
// For deriving curing context, must not be accessed directly.
toplevel atomic.Pointer[toplevel]
- // For waiting on dependency curing goroutines.
+ // For waiting on input curing goroutines.
wg sync.WaitGroup
// Reports new cures and passed to [Artifact].
msg message.Msg
@@ -1633,6 +1633,24 @@ func (c *Cache) Cure(a Artifact) (
return
}
+ pathname, checksum, _, err = c.cure(a, true)
+ return
+}
+
+// CureWhence is like Cure, but returns the whence value.
+func (c *Cache) CureWhence(a Artifact) (
+ pathname *check.Absolute,
+ checksum unique.Handle[Checksum],
+ whence int,
+ err error,
+) {
+ c.abortMu.RLock()
+ defer c.abortMu.RUnlock()
+
+ if err = c.toplevel.Load().ctx.Err(); err != nil {
+ return
+ }
+
return c.cure(a, true)
}
@@ -1971,11 +1989,41 @@ func (e HangingInputError) Error() string {
return Encode(unique.Handle[ID](e).Value()) + " is unavailable"
}
+const (
+ // WNew indicates a cure entering the implementation.
+ WNew = iota
+ // WCache indicates an [Artifact] present in the cache.
+ WCache
+ // WSubstitute indicates an [Artifact] hitting a content-based input
+ // substitution.
+ WSubstitute
+ // WExternal indicates a cure entering the external cache.
+ WExternal
+)
+
+// WhenceString returns a printable string for a whence value.
+func WhenceString(whence int) string {
+ switch whence {
+ case WNew:
+ return "new"
+ case WCache:
+ return "cache"
+ case WSubstitute:
+ return "substitute"
+ case WExternal:
+ return "external"
+
+ default:
+ return "invalid whence " + strconv.Itoa(whence)
+ }
+}
+
// cure implements Cure without acquiring a read lock on abortMu. cure must not
// be entered during Abort.
func (c *Cache) cure(a Artifact, curesExempt bool) (
pathname *check.Absolute,
checksum unique.Handle[Checksum],
+ whence int,
err error,
) {
id := c.Ident(a)
@@ -2001,6 +2049,7 @@ func (c *Cache) cure(a Artifact, curesExempt bool) (
)
ctx, done, checksum, err = c.loadOrStoreIdent(id)
if done == nil {
+ whence = WCache
return
} else {
defer func() { c.finaliseIdent(done, id, checksum, err) }()
@@ -2008,6 +2057,7 @@ func (c *Cache) cure(a Artifact, curesExempt bool) (
checksum, err = c.tryChecksum(pathname)
if err == nil || !errors.Is(err, os.ErrNotExist) {
+ whence = WCache
return
}
@@ -2077,6 +2127,7 @@ func (c *Cache) cure(a Artifact, curesExempt bool) (
}
}
+ whence = WNew
if c.msg.IsVerbose() {
rn := reportName(a, id)
c.msg.Verbosef("curing %s...", rn)
@@ -2095,6 +2146,7 @@ func (c *Cache) cure(a Artifact, curesExempt bool) (
// cure FileArtifact outside type switch to skip TContext initialisation
if f, ok := a.(FileArtifact); ok {
if checksumFi != nil {
+ whence = WCache
if !checksumFi.Mode().IsRegular() {
// unreachable
err = InvalidFileModeError(checksumFi.Mode())
@@ -2199,6 +2251,7 @@ func (c *Cache) cure(a Artifact, curesExempt bool) (
}
if checksumFi != nil {
+ whence = WCache
if !checksumFi.Mode().IsDir() {
// unreachable
err = InvalidFileModeError(checksumFi.Mode())
@@ -2308,6 +2361,7 @@ func (c *Cache) cure(a Artifact, curesExempt bool) (
return
}
if substituteChecksum != zeroChecksum {
+ whence = WSubstitute
checksum = substituteChecksum
checksums = Encode(checksum.Value())
checksumPathname = c.base.Append(
@@ -2332,6 +2386,7 @@ func (c *Cache) cure(a Artifact, curesExempt bool) (
defer f.destroy(&err)
if extern {
+ whence = WExternal
if checksum != zeroChecksum && externChecksum != checksum {
err = &ChecksumMismatchError{externChecksum.Value(), checksum.Value()}
if c.msg.IsVerbose() {
@@ -2471,7 +2526,7 @@ func (pending *pendingArtifactDep) cure(c *Cache) {
defer pending.Done()
var err error
- pending.resP.pathname, pending.resP.checksum, err = c.cure(pending.a, false)
+ pending.resP.pathname, pending.resP.checksum, _, err = c.cure(pending.a, false)
if err == nil {
return
}
diff --git a/internal/pkg/pkg_test.go b/internal/pkg/pkg_test.go
index d03216f6..ff51d583 100644
--- a/internal/pkg/pkg_test.go
+++ b/internal/pkg/pkg_test.go
@@ -627,6 +627,7 @@ type cureStep struct {
pathname *check.Absolute
output expectsKnown
+ whence int
err error
}
@@ -646,7 +647,7 @@ func cureMany(t *testing.T, c *pkg.Cache, steps []cureStep) {
for _, step := range steps {
t.Log("cure step:", step.name)
- if pathname, checksum, err := c.Cure(step.a); !reflect.DeepEqual(err, step.err) {
+ if pathname, checksum, whence, err := c.CureWhence(step.a); !reflect.DeepEqual(err, step.err) {
faults, _err := c.ReadFaults(step.a)
if _err != nil {
t.Errorf("ReadFaults: error = %v", _err)
@@ -663,6 +664,8 @@ func cureMany(t *testing.T, c *pkg.Cache, steps []cureStep) {
t.Logf("faulting cure terminated %s ago", time.Since(faults[0].Time()))
}
t.Fatalf("Cure: error = %v, want %v", err, step.err)
+ } else if step.whence != whence {
+ t.Fatalf("Cure: whence = %s, want %s", pkg.WhenceString(whence), pkg.WhenceString(step.whence))
} else if step.pathname != ignorePathname && !pathname.Is(step.pathname) {
t.Fatalf("Cure: pathname = %q, want %q", pathname, step.pathname)
} else if step.output == nil || checksum != makeChecksumH(step.output.hash()) {
@@ -774,28 +777,28 @@ func TestCache(t *testing.T) {
identifier,
new(testdata.hash()),
testdata, nil,
- ), wantPathname, testdata, nil},
+ ), wantPathname, testdata, pkg.WNew, nil},
{"identical content", newStubFile(
pkg.KindHTTPGet,
identifier0,
new(testdata.hash()),
testdata, nil,
- ), wantPathname0, testdata, nil},
+ ), wantPathname0, testdata, pkg.WCache, nil},
{"existing entry", newStubFile(
pkg.KindHTTPGet,
identifier,
new(testdata.hash()),
testdata, nil,
- ), wantPathname, testdata, nil},
+ ), wantPathname, testdata, pkg.WCache, nil},
{"checksum mismatch", newStubFile(
pkg.KindHTTPGet,
pkg.ID{0xff, 0},
new(pkg.Checksum),
testdata, nil,
- ), nil, nil, &pkg.ChecksumMismatchError{
+ ), nil, nil, pkg.WNew, &pkg.ChecksumMismatchError{
Got: testdata.hash(),
}},
@@ -816,12 +819,12 @@ func TestCache(t *testing.T) {
0x36, 0x65, 0x59, 0x33, 0xec, 0x2b,
0x41, 0x34, 0x65, 0x96, 0x68, 0x17,
0xa9, 0xc2, 0x08, 0xa1, 0x17, 0x17,
- }, nil},
+ }, pkg.WNew, nil},
{"incomplete implementation", struct{ pkg.Artifact }{&stubArtifact{
kind: pkg.KindExec,
params: []byte("artifact overridden to be incomplete"),
- }}, nil, nil, pkg.InvalidArtifactError(pkg.MustDecode(
+ }}, nil, nil, pkg.WNew, pkg.InvalidArtifactError(pkg.MustDecode(
"E__uZ1sLIvb84vzSm5Uezb03RogsiaeTt1nfIVv8TKnnf4LqwtSi-smdHhlkZrUJ",
))},
@@ -830,18 +833,18 @@ func TestCache(t *testing.T) {
pkg.ID{0xff, 1},
nil,
nil, stub.UniqueError(0xcafe),
- ), nil, nil, stub.UniqueError(0xcafe)},
+ ), nil, nil, pkg.WNew, stub.UniqueError(0xcafe)},
{"error caching", newStubFile(
pkg.KindHTTPGet,
pkg.ID{0xff, 1},
nil,
nil, nil,
- ), nil, nil, stub.UniqueError(0xcafe)},
+ ), nil, nil, pkg.WCache, stub.UniqueError(0xcafe)},
{"cache hit bad type", overrideChecksum{testdata.hash(), overrideIdent{pkg.ID{0xff, 2}, &stubArtifact{
kind: pkg.KindTar,
- }}}, nil, nil, pkg.InvalidFileModeError(
+ }}}, nil, nil, pkg.WCache, pkg.InvalidFileModeError(
0400,
)},
@@ -853,7 +856,7 @@ func TestCache(t *testing.T) {
cure: func(f *pkg.FContext) error {
panic("attempting to cure impossible artifact")
},
- }, nil, nil, &pkg.DependencyCureError{
+ }, nil, nil, pkg.WNew, &pkg.DependencyCureError{
{
A: failingFile,
Err: struct {
@@ -875,7 +878,7 @@ func TestCache(t *testing.T) {
cureMany(t, c0, []cureStep{
{"cache hit ident", overrideIdent{
id: identifier,
- }, wantPathname, testdata, nil},
+ }, wantPathname, testdata, pkg.WCache, nil},
{"cache miss checksum match", newStubFile(
pkg.KindHTTPGet,
@@ -886,7 +889,7 @@ func TestCache(t *testing.T) {
), base.Append(
"identifier",
pkg.Encode(testdata.hash()),
- ), testdata, nil},
+ ), testdata, pkg.WNew, nil},
})
// cure after close
@@ -1016,30 +1019,30 @@ func TestCache(t *testing.T) {
{"initial directory", overrideChecksum{want.hash(), overrideIdent{id, &stubArtifact{
kind: pkg.KindTar,
cure: makeSample,
- }}}, wantPathname, want, nil},
+ }}}, wantPathname, want, pkg.WNew, nil},
{"identical identifier", overrideChecksum{want.hash(), overrideIdent{id, &stubArtifact{
kind: pkg.KindTar,
- }}}, wantPathname, want, nil},
+ }}}, wantPathname, want, pkg.WCache, nil},
{"identical checksum", overrideIdent{id0, &stubArtifact{
kind: pkg.KindTar,
cure: makeSample,
- }}, wantPathname0, want, nil},
+ }}, wantPathname0, want, pkg.WNew, nil},
{"cure fault", overrideIdent{pkg.ID{0xff, 0}, &stubArtifact{
kind: pkg.KindTar,
cure: func(t *pkg.TContext) error {
return makeGarbage(t.GetWorkDir(), stub.UniqueError(0xcafe))
},
- }}, nil, nil, stub.UniqueError(0xcafe)},
+ }}, nil, nil, pkg.WNew, stub.UniqueError(0xcafe)},
{"checksum mismatch", overrideChecksum{pkg.Checksum{}, overrideIdent{pkg.ID{0xff, 1}, &stubArtifact{
kind: pkg.KindTar,
cure: func(t *pkg.TContext) error {
return makeGarbage(t.GetWorkDir(), nil)
},
- }}}, nil, nil, &pkg.ChecksumMismatchError{
+ }}}, nil, nil, pkg.WNew, &pkg.ChecksumMismatchError{
Got: pkg.MustDecode(
"CUx-3hSbTWPsbMfDhgalG4Ni_GmR9TnVX8F99tY_P5GtkYvczg9RrF5zO0jX9XYT",
),
@@ -1050,7 +1053,7 @@ func TestCache(t *testing.T) {
pkg.ID{0xff, 2},
new(want.hash()),
testdata, nil,
- ), nil, nil, pkg.InvalidFileModeError(
+ ), nil, nil, pkg.WCache, pkg.InvalidFileModeError(
fs.ModeDir | 0500,
)},
@@ -1064,7 +1067,7 @@ func TestCache(t *testing.T) {
_, err = io.ReadAll(r)
return err
},
- }}, nil, nil, &os.PathError{
+ }}, nil, nil, pkg.WNew, &os.PathError{
Op: "read",
Path: base.Append(
"checksum",
@@ -1078,14 +1081,14 @@ func TestCache(t *testing.T) {
cure: func(t *pkg.TContext) error {
return nil
},
- }}, nil, nil, pkg.NoOutputError{}},
+ }}, nil, nil, pkg.WNew, pkg.NoOutputError{}},
{"file output", overrideIdent{pkg.ID{0xff, 5}, &stubArtifact{
kind: pkg.KindTar,
cure: func(t *pkg.TContext) error {
return os.WriteFile(t.GetWorkDir().String(), []byte{0}, 0400)
},
- }}, nil, nil, errors.New("non-file artifact produced regular file")},
+ }}, nil, nil, pkg.WNew, errors.New("non-file artifact produced regular file")},
{"symlink output", overrideIdent{pkg.ID{0xff, 6}, &stubArtifact{
kind: pkg.KindTar,
@@ -1095,7 +1098,7 @@ func TestCache(t *testing.T) {
t.GetWorkDir().String(),
)
},
- }}, nil, nil, pkg.InvalidFileModeError(
+ }}, nil, nil, pkg.WNew, pkg.InvalidFileModeError(
fs.ModeSymlink | 0777,
)},
@@ -1116,7 +1119,7 @@ func TestCache(t *testing.T) {
}, base.Append(
"identifier",
"xMDWovje7OfyIaDy_2VnjpKxRqSOQ_LoeD946t-3WsS2V2SeMJ7nDGrNfpa4Pbc-",
- ), want, nil},
+ ), want, pkg.WNew, nil},
{"substitutable", &stubArtifactF{
kind: pkg.KindExec,
@@ -1135,7 +1138,7 @@ func TestCache(t *testing.T) {
}, base.Append(
"identifier",
"k2ilgG5KQ9NXnMoT2oB6NdwOnSPRn_H24oXQc4l6qOYIxIG9XfuEczeyrR8UEv_f",
- ), want, nil},
+ ), want, pkg.WSubstitute, nil},
})
if c0, err := unsafeOpen(
@@ -1164,7 +1167,7 @@ func TestCache(t *testing.T) {
}, base.Append(
"identifier",
"_EmV5nsYZ2UWHgRmLDMU8i-rJWDx-kv5_1pFrzQI7vMMCM5mAXivO8UZtVfOqMR_",
- ), want, nil},
+ ), want, pkg.WSubstitute, nil},
})
}
@@ -1235,7 +1238,7 @@ func TestCache(t *testing.T) {
pkg.ID{0xff, 1},
nil,
nil, stub.UniqueError(0xbad),
- ), nil, nil, stub.UniqueError(0xbad)},
+ ), nil, nil, pkg.WNew, stub.UniqueError(0xbad)},
{"file output", overrideIdent{pkg.ID{0xff, 2}, &stubArtifact{
kind: pkg.KindTar,
@@ -1246,7 +1249,7 @@ func TestCache(t *testing.T) {
0400,
)
},
- }}, nil, nil, errors.New(
+ }}, nil, nil, pkg.WNew, errors.New(
"non-file artifact produced regular file",
)},
})
@@ -1363,14 +1366,14 @@ func TestCache(t *testing.T) {
}}}, base.Append(
"identifier",
pkg.Encode(pkg.ID{0xff, 0}),
- ), want, nil},
+ ), want, pkg.WNew, nil},
{"reject", overrideChecksum{want.hash(), overrideIdent{pkg.ID{0xfe, 1}, &stubArtifact{
kind: pkg.KindTar,
cure: func(t *pkg.TContext) error {
return makeGarbage(t.GetWorkDir(), stub.UniqueError(0xbad))
},
- }}}, nil, nil, stub.UniqueError(0xbad)},
+ }}}, nil, nil, pkg.WNew, stub.UniqueError(0xbad)},
{"match", overrideChecksum{want.hash(), overrideIdent{pkg.ID{0xff, 1}, &stubArtifact{
kind: pkg.KindTar,
@@ -1380,7 +1383,7 @@ func TestCache(t *testing.T) {
}}}, base.Append(
"identifier",
pkg.Encode(pkg.ID{0xff, 1}),
- ), want, nil},
+ ), want, pkg.WNew, nil},
})
}, expectsFS{
".": {Mode: fs.ModeDir | 0700},
@@ -1408,7 +1411,7 @@ func TestCache(t *testing.T) {
), base.Append(
"identifier",
pkg.Encode(pkg.Checksum{0xfe, 0}),
- ), expectsChecksum{0xff, 0}, nil},
+ ), expectsChecksum{0xff, 0}, pkg.WNew, nil},
})
for _, p := range [][]string{
@@ -1485,7 +1488,7 @@ func TestCache(t *testing.T) {
), expectsFS{
".": {Mode: fs.ModeDir | 0500},
"result": {Mode: 0444},
- }, nil},
+ }, pkg.WNew, nil},
{"substituted", substituted, base.Append(
"identifier",
@@ -1493,7 +1496,7 @@ func TestCache(t *testing.T) {
), expectsFS{
".": {Mode: fs.ModeDir | 0500},
"result": {Mode: 0444},
- }, nil},
+ }, pkg.WSubstitute, nil},
})
}, expectsFS{
".": {Mode: fs.ModeDir | 0700},
@@ -1586,14 +1589,14 @@ func TestCache(t *testing.T) {
{"extern", a, base.Append(
"identifier",
pkg.Encode(wantIdent.Value()),
- ), wantOutput, nil},
+ ), wantOutput, pkg.WExternal, nil},
{"substitute", _a, base.Append(
"identifier",
pkg.Encode(_wantIdent.Value()),
- ), _wantOutput, nil},
+ ), _wantOutput, pkg.WExternal, nil},
- {"mismatch", kca, nil, nil, &pkg.ChecksumMismatchError{
+ {"mismatch", kca, nil, nil, pkg.WExternal, &pkg.ChecksumMismatchError{
Got: wantChecksum,
}},
})
@@ -1717,27 +1720,27 @@ func TestCache(t *testing.T) {
{"extern", a, base.Append(
"identifier",
pkg.Encode(wantIdent.Value()),
- ), wantOutput, nil},
+ ), wantOutput, pkg.WExternal, nil},
{"flood shallow extern", fia, base.Append(
"identifier",
pkg.Encode(fiaIdent.Value()),
- ), wantOutput, nil},
+ ), wantOutput, pkg.WExternal, nil},
{"substitute", _a, base.Append(
"identifier",
pkg.Encode(_wantIdent.Value()),
- ), _wantOutput, nil},
+ ), _wantOutput, pkg.WExternal, nil},
{"flood shallow local", flia, base.Append(
"identifier",
pkg.Encode(fliaIdent.Value()),
- ), wantOutput, nil},
+ ), wantOutput, pkg.WExternal, nil},
{"flood shallow hanging", fhia, nil, nil,
- pkg.HangingInputError(c.Ident(h))},
+ pkg.WNew, pkg.HangingInputError(c.Ident(h))},
- {"mismatch", kca, nil, nil, &pkg.ChecksumMismatchError{
+ {"mismatch", kca, nil, nil, pkg.WExternal, &pkg.ChecksumMismatchError{
Got: wantChecksum,
}},
})
@@ -1781,7 +1784,7 @@ func TestErrors(t *testing.T) {
}{
{"InvalidLookupError", pkg.InvalidLookupError{
0xff, 0xf0,
- }, "attempting to look up non-dependency artifact __AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},
+ }, "attempting to look up non-input artifact __AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"},
{"InvalidArtifactError", pkg.InvalidArtifactError{
0xff, 0xfd,
diff --git a/internal/pkg/tar_test.go b/internal/pkg/tar_test.go
index 29ddcdad..f24034f9 100644
--- a/internal/pkg/tar_test.go
+++ b/internal/pkg/tar_test.go
@@ -212,24 +212,24 @@ func checkTarHTTP(
&client,
"file:///testdata",
testdataChecksum,
- ), pkg.Gzip)), ignorePathname, want, nil},
+ ), pkg.Gzip)), ignorePathname, want, pkg.WNew, nil},
{"directory", pkg.NewTar(pkg.NewDecompress(
&tarDir,
pkg.Gzip,
- )), ignorePathname, want, nil},
+ )), ignorePathname, want, pkg.WNew, nil},
{"multiple entries", pkg.NewTar(pkg.NewDecompress(
&tarDirMulti,
pkg.Gzip,
- )), nil, nil, errors.New(
+ )), nil, nil, pkg.WNew, errors.New(
"input directory does not contain a single regular file",
)},
{"bad type", pkg.NewTar(pkg.NewDecompress(
&tarDirType,
pkg.Gzip,
- )), nil, nil, errors.New(
+ )), nil, nil, pkg.WNew, errors.New(
"input directory does not contain a single regular file",
)},
@@ -239,6 +239,6 @@ func checkTarHTTP(
cure: func(t *pkg.TContext) error {
return stub.UniqueError(0xcafe)
},
- }), nil, nil, stub.UniqueError(0xcafe)},
+ }), nil, nil, pkg.WNew, stub.UniqueError(0xcafe)},
})
}