treewide: remove sample store paths

This should finally build on nix.
This commit is contained in:
2025-07-20 04:22:28 +09:00
parent 66a4079114
commit 5f8b5bcb3d
10 changed files with 92 additions and 125 deletions
+3 -16
View File
@@ -26,14 +26,7 @@ func TestInstantiated(t *testing.T) {
{"unexpected quotes short", nil, &nix.MalformedInstantiatedError{Type: nix.InstantiatedUnexpectedQuotes}}, {"unexpected quotes short", nil, &nix.MalformedInstantiatedError{Type: nix.InstantiatedUnexpectedQuotes}},
{"not absolute", nil, &nix.MalformedInstantiatedError{Type: nix.InstantiatedNotAbsolute}}, {"not absolute", nil, &nix.MalformedInstantiatedError{Type: nix.InstantiatedNotAbsolute}},
{"good segment", []string{ {"good segment", segmentWant, nil},
"/nix/store/3zilrlmq7r6rpzfd94mwss32b62yinj5-bootstrap-stage0-stdenv-linux.drv",
"/nix/store/7yfwy95p6lcdpljdajs5aw10h6q0sfx0-update-autotools-gnu-config-scripts-hook.drv",
"/nix/store/bamwxswxacs3cjdcydv0z7bj22d7g2kc-config.guess-948ae97.drv",
"/nix/store/gyks6vvl7x0gq214ldjhi3w4rg37nh8i-zlib-1.3.1.tar.gz.drv",
"/nix/store/nbsdqpfzh1jlpmh95s69b3iivfcvv3lh-config.sub-948ae97.drv",
"/nix/store/ysp83x9nrks28zkblqmnc1s1kb68dr69-gnu-config-2024-01-01.drv",
}, nil},
{"getchoo atlas", getchooAtlasInstantiated, nil}, {"getchoo atlas", getchooAtlasInstantiated, nil},
{"getchoo glados", getchooGladosInstantiated, nil}, {"getchoo glados", getchooGladosInstantiated, nil},
@@ -93,12 +86,6 @@ func stubInstantiatedEvaluator(args []string) error {
} }
func TestInstantiatedDecoderStopEarly(t *testing.T) { func TestInstantiatedDecoderStopEarly(t *testing.T) {
want := []string{
"/nix/store/gyks6vvl7x0gq214ldjhi3w4rg37nh8i-zlib-1.3.1.tar.gz.drv",
"/nix/store/bamwxswxacs3cjdcydv0z7bj22d7g2kc-config.guess-948ae97.drv",
"/nix/store/nbsdqpfzh1jlpmh95s69b3iivfcvv3lh-config.sub-948ae97.drv",
}
decoder := nix.NewInstantiatedDecoder(strings.NewReader(segmentPrefix+segmentBody+segmentSuffix), os.Stderr) decoder := nix.NewInstantiatedDecoder(strings.NewReader(segmentPrefix+segmentBody+segmentSuffix), os.Stderr)
counter := 3 counter := 3
got := make([]string, 0, counter) got := make([]string, 0, counter)
@@ -110,8 +97,8 @@ func TestInstantiatedDecoderStopEarly(t *testing.T) {
} }
} }
if !slices.Equal(got, want) { if !slices.Equal(got, segmentEarly) {
t.Errorf("Instantiated: %#v, want %#v", got, want) t.Errorf("Instantiated: %#v, want %#v", got, segmentEarly)
} }
} }
-27
View File
@@ -1,27 +0,0 @@
package nix_test
import _ "embed"
// github:getchoo/borealis#atlas
var (
getchooAtlasOut = string(sampleMustGunzip(getchooAtlasOutGzip))
//go:embed testdata/getchoo_atlas.gz
getchooAtlasOutGzip []byte
getchooAtlasInstantiated = sampleSplitPaths(sampleMustGunzip(getchooAtlasInstantiatedGzip))
//go:embed testdata/instantiated/getchoo_atlas.gz
getchooAtlasInstantiatedGzip []byte
getchooAtlasShow = sampleMustGunzip(getchooAtlasShowGzip)
//go:embed testdata/derivation/show_getchoo_atlas.json.gz
getchooAtlasShowGzip []byte
getchooAtlasCollective = sampleSplitPaths(sampleMustGunzip(getchooAtlasCollectiveGzip))
//go:embed testdata/derivation/collect_getchoo_atlas.gz
getchooAtlasCollectiveGzip []byte
getchooAtlasStdin = string(sampleMustGunzip(getchooAtlasStdinGzip))
//go:embed testdata/format/stdin_getchoo_atlas.gz
getchooAtlasStdinGzip []byte
)
-27
View File
@@ -1,27 +0,0 @@
package nix_test
import _ "embed"
// github:getchoo/borealis#glados
var (
getchooGladosOut = string(sampleMustGunzip(getchooGladosOutGzip))
//go:embed testdata/getchoo_glados.gz
getchooGladosOutGzip []byte
getchooGladosInstantiated = sampleSplitPaths(sampleMustGunzip(getchooGladosInstantiatedGzip))
//go:embed testdata/instantiated/getchoo_glados.gz
getchooGladosInstantiatedGzip []byte
getchooGladosShow = sampleMustGunzip(getchooGladosShowGzip)
//go:embed testdata/derivation/show_getchoo_glados.json.gz
getchooGladosShowGzip []byte
getchooGladosCollective = sampleSplitPaths(sampleMustGunzip(getchooGladosCollectiveGzip))
//go:embed testdata/derivation/collect_getchoo_glados.gz
getchooGladosCollectiveGzip []byte
getchooGladosStdin = string(sampleMustGunzip(getchooGladosStdinGzip))
//go:embed testdata/format/stdin_getchoo_glados.gz
getchooGladosStdinGzip []byte
)
-29
View File
@@ -1,29 +0,0 @@
package nix_test
import (
_ "embed"
)
// git+https://tangled.sh/@pluie.me/flake#pappardelle
var (
pluiedevPappardelleOut = string(sampleMustGunzip(pluiedevPappardelleGzip))
//go:embed testdata/pluiedev_pappardelle.gz
pluiedevPappardelleGzip []byte
pluiedevPappardelleInstantiated = sampleSplitPaths(sampleMustGunzip(pluiedevPappardelleInstantiatedGzip))
//go:embed testdata/instantiated/pluiedev_pappardelle.gz
pluiedevPappardelleInstantiatedGzip []byte
pluiedevPappardelleShow = sampleMustGunzip(pluiedevPappardelleShowGzip)
//go:embed testdata/derivation/show_pluiedev_pappardelle.json.gz
pluiedevPappardelleShowGzip []byte
pluiedevPappardelleCollective = sampleSplitPaths(sampleMustGunzip(pluiedevPappardelleCollectiveGzip))
//go:embed testdata/derivation/collect_pluiedev_pappardelle.gz
pluiedevPappardelleCollectiveGzip []byte
pluiedevPappardelleStdin = string(sampleMustGunzip(pluiedevPappardelleStdinGzip))
//go:embed testdata/format/stdin_pluiedev_pappardelle.gz
pluiedevPappardelleStdinGzip []byte
)
+89 -26
View File
@@ -3,6 +3,7 @@ package nix_test
import ( import (
"bytes" "bytes"
"compress/gzip" "compress/gzip"
_ "embed"
"io" "io"
"strings" "strings"
) )
@@ -38,33 +39,23 @@ var drvShow = map[string][]byte{
"pluiedev pappardelle": pluiedevPappardelleShow, "pluiedev pappardelle": pluiedevPappardelleShow,
} }
const ( var (
segmentPrefix = `evaluating file '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/development/libraries/zlib/default.nix' segmentPrefix = string(sampleMustGunzip(segmentPrefixGzip))
evaluating file '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/fetchurl/boot.nix' segmentBody = string(sampleMustGunzip(segmentBodyGzip))
performing daemon worker op: 7 segmentSuffix = string(sampleMustGunzip(segmentSuffixGzip))
instantiated 'zlib-1.3.1.tar.gz' -> '/nix/store/gyks6vvl7x0gq214ldjhi3w4rg37nh8i-zlib-1.3.1.tar.gz.drv' segmentWant = sampleSplitPaths(sampleMustGunzip(segmentWantGzip))
source path '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh' is uncacheable segmentEarly = sampleSplitPaths(sampleMustGunzip(segmentEarlyGzip))
copying '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh' to the store...
performing daemon worker op: 7
copied '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh' to '/nix/store/96rvfw5vlv1hwwm9sdxhdkkpjyym6p2x-update-autotools-gnu-config-scripts.sh'
copied source '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh' -> '/nix/store/96rvfw5vlv1hwwm9sdxhdkkpjyym6p2x-update-autotools-gnu-config-scripts.sh'
evaluating file '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/by-name/gn/gnu-config/package.nix'
performing daemon worker op: 7
instantiated 'config.guess-948ae97' -> '/nix/store/bamwxswxacs3cjdcydv0z7bj22d7g2kc-config.guess-948ae97.drv'
performing daemon worker op: 7
`
segmentBody = `instantiated 'config.sub-948ae97' -> '/nix/store/nbsdqpfzh1jlpmh95s69b3iivfcvv3lh-config.sub-948ae97.drv'` //go:embed testdata/segment/prefix.gz
segmentPrefixGzip []byte
segmentSuffix = ` //go:embed testdata/segment/body.gz
performing daemon worker op: 7 segmentBodyGzip []byte
instantiated 'gnu-config-2024-01-01' -> '/nix/store/ysp83x9nrks28zkblqmnc1s1kb68dr69-gnu-config-2024-01-01.drv' //go:embed testdata/segment/suffix.gz
performing daemon worker op: 7 segmentSuffixGzip []byte
instantiated 'bootstrap-stage0-stdenv-linux' -> '/nix/store/3zilrlmq7r6rpzfd94mwss32b62yinj5-bootstrap-stage0-stdenv-linux.drv' //go:embed testdata/segment/want.gz
performing daemon worker op: 7 segmentWantGzip []byte
instantiated 'update-autotools-gnu-config-scripts-hook' -> '/nix/store/7yfwy95p6lcdpljdajs5aw10h6q0sfx0-update-autotools-gnu-config-scripts-hook.drv' //go:embed testdata/segment/early.gz
source path '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/bintools-wrapper/ld-wrapper.sh' is uncacheable segmentEarlyGzip []byte
copying '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/bintools-wrapper/ld-wrapper.sh' to the store...`
) )
func sampleSplitPaths(data []byte) []string { func sampleSplitPaths(data []byte) []string {
@@ -80,3 +71,75 @@ func sampleMustGunzip(data []byte) []byte {
} }
return u return u
} }
// github:getchoo/borealis#atlas
var (
getchooAtlasOut = string(sampleMustGunzip(getchooAtlasOutGzip))
//go:embed testdata/getchoo_atlas.gz
getchooAtlasOutGzip []byte
getchooAtlasInstantiated = sampleSplitPaths(sampleMustGunzip(getchooAtlasInstantiatedGzip))
//go:embed testdata/instantiated/getchoo_atlas.gz
getchooAtlasInstantiatedGzip []byte
getchooAtlasShow = sampleMustGunzip(getchooAtlasShowGzip)
//go:embed testdata/derivation/show_getchoo_atlas.json.gz
getchooAtlasShowGzip []byte
getchooAtlasCollective = sampleSplitPaths(sampleMustGunzip(getchooAtlasCollectiveGzip))
//go:embed testdata/derivation/collect_getchoo_atlas.gz
getchooAtlasCollectiveGzip []byte
getchooAtlasStdin = string(sampleMustGunzip(getchooAtlasStdinGzip))
//go:embed testdata/format/stdin_getchoo_atlas.gz
getchooAtlasStdinGzip []byte
)
// github:getchoo/borealis#glados
var (
getchooGladosOut = string(sampleMustGunzip(getchooGladosOutGzip))
//go:embed testdata/getchoo_glados.gz
getchooGladosOutGzip []byte
getchooGladosInstantiated = sampleSplitPaths(sampleMustGunzip(getchooGladosInstantiatedGzip))
//go:embed testdata/instantiated/getchoo_glados.gz
getchooGladosInstantiatedGzip []byte
getchooGladosShow = sampleMustGunzip(getchooGladosShowGzip)
//go:embed testdata/derivation/show_getchoo_glados.json.gz
getchooGladosShowGzip []byte
getchooGladosCollective = sampleSplitPaths(sampleMustGunzip(getchooGladosCollectiveGzip))
//go:embed testdata/derivation/collect_getchoo_glados.gz
getchooGladosCollectiveGzip []byte
getchooGladosStdin = string(sampleMustGunzip(getchooGladosStdinGzip))
//go:embed testdata/format/stdin_getchoo_glados.gz
getchooGladosStdinGzip []byte
)
// git+https://tangled.sh/@pluie.me/flake#pappardelle
var (
pluiedevPappardelleOut = string(sampleMustGunzip(pluiedevPappardelleGzip))
//go:embed testdata/pluiedev_pappardelle.gz
pluiedevPappardelleGzip []byte
pluiedevPappardelleInstantiated = sampleSplitPaths(sampleMustGunzip(pluiedevPappardelleInstantiatedGzip))
//go:embed testdata/instantiated/pluiedev_pappardelle.gz
pluiedevPappardelleInstantiatedGzip []byte
pluiedevPappardelleShow = sampleMustGunzip(pluiedevPappardelleShowGzip)
//go:embed testdata/derivation/show_pluiedev_pappardelle.json.gz
pluiedevPappardelleShowGzip []byte
pluiedevPappardelleCollective = sampleSplitPaths(sampleMustGunzip(pluiedevPappardelleCollectiveGzip))
//go:embed testdata/derivation/collect_pluiedev_pappardelle.gz
pluiedevPappardelleCollectiveGzip []byte
pluiedevPappardelleStdin = string(sampleMustGunzip(pluiedevPappardelleStdinGzip))
//go:embed testdata/format/stdin_pluiedev_pappardelle.gz
pluiedevPappardelleStdinGzip []byte
)
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.