treewide: remove sample store paths

This should finally build on nix.
This commit is contained in:
Ophestra 2025-07-20 04:22:28 +09:00
parent 66a4079114
commit 5f8b5bcb3d
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q
10 changed files with 92 additions and 125 deletions

View File

@ -26,14 +26,7 @@ func TestInstantiated(t *testing.T) {
{"unexpected quotes short", nil, &nix.MalformedInstantiatedError{Type: nix.InstantiatedUnexpectedQuotes}},
{"not absolute", nil, &nix.MalformedInstantiatedError{Type: nix.InstantiatedNotAbsolute}},
{"good segment", []string{
"/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},
{"good segment", segmentWant, nil},
{"getchoo atlas", getchooAtlasInstantiated, nil},
{"getchoo glados", getchooGladosInstantiated, nil},
@ -93,12 +86,6 @@ func stubInstantiatedEvaluator(args []string) error {
}
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)
counter := 3
got := make([]string, 0, counter)
@ -110,8 +97,8 @@ func TestInstantiatedDecoderStopEarly(t *testing.T) {
}
}
if !slices.Equal(got, want) {
t.Errorf("Instantiated: %#v, want %#v", got, want)
if !slices.Equal(got, segmentEarly) {
t.Errorf("Instantiated: %#v, want %#v", got, segmentEarly)
}
}

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
)

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
)

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
)

View File

@ -3,6 +3,7 @@ package nix_test
import (
"bytes"
"compress/gzip"
_ "embed"
"io"
"strings"
)
@ -38,33 +39,23 @@ var drvShow = map[string][]byte{
"pluiedev pappardelle": pluiedevPappardelleShow,
}
const (
segmentPrefix = `evaluating file '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/development/libraries/zlib/default.nix'
evaluating file '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/fetchurl/boot.nix'
performing daemon worker op: 7
instantiated 'zlib-1.3.1.tar.gz' -> '/nix/store/gyks6vvl7x0gq214ldjhi3w4rg37nh8i-zlib-1.3.1.tar.gz.drv'
source path '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh' is uncacheable
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
`
var (
segmentPrefix = string(sampleMustGunzip(segmentPrefixGzip))
segmentBody = string(sampleMustGunzip(segmentBodyGzip))
segmentSuffix = string(sampleMustGunzip(segmentSuffixGzip))
segmentWant = sampleSplitPaths(sampleMustGunzip(segmentWantGzip))
segmentEarly = sampleSplitPaths(sampleMustGunzip(segmentEarlyGzip))
segmentBody = `instantiated 'config.sub-948ae97' -> '/nix/store/nbsdqpfzh1jlpmh95s69b3iivfcvv3lh-config.sub-948ae97.drv'`
segmentSuffix = `
performing daemon worker op: 7
instantiated 'gnu-config-2024-01-01' -> '/nix/store/ysp83x9nrks28zkblqmnc1s1kb68dr69-gnu-config-2024-01-01.drv'
performing daemon worker op: 7
instantiated 'bootstrap-stage0-stdenv-linux' -> '/nix/store/3zilrlmq7r6rpzfd94mwss32b62yinj5-bootstrap-stage0-stdenv-linux.drv'
performing daemon worker op: 7
instantiated 'update-autotools-gnu-config-scripts-hook' -> '/nix/store/7yfwy95p6lcdpljdajs5aw10h6q0sfx0-update-autotools-gnu-config-scripts-hook.drv'
source path '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/bintools-wrapper/ld-wrapper.sh' is uncacheable
copying '/nix/store/vdzlppvrdkz9rv14q4j02g9kpjbww2ww-source/pkgs/build-support/bintools-wrapper/ld-wrapper.sh' to the store...`
//go:embed testdata/segment/prefix.gz
segmentPrefixGzip []byte
//go:embed testdata/segment/body.gz
segmentBodyGzip []byte
//go:embed testdata/segment/suffix.gz
segmentSuffixGzip []byte
//go:embed testdata/segment/want.gz
segmentWantGzip []byte
//go:embed testdata/segment/early.gz
segmentEarlyGzip []byte
)
func sampleSplitPaths(data []byte) []string {
@ -80,3 +71,75 @@ func sampleMustGunzip(data []byte) []byte {
}
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
testdata/segment/body.gz vendored Normal file

Binary file not shown.

BIN
testdata/segment/early.gz vendored Normal file

Binary file not shown.

BIN
testdata/segment/prefix.gz vendored Normal file

Binary file not shown.

BIN
testdata/segment/suffix.gz vendored Normal file

Binary file not shown.

BIN
testdata/segment/want.gz vendored Normal file

Binary file not shown.