tests: verify the new tools through the world shell
This commit is contained in:
@@ -34,4 +34,5 @@ nix develop -c cargo test -p sausage-archive-tools --target aarch64-unknown-linu
|
||||
|
||||
The test script compares cross-format tar and gzip transfers with native tools.
|
||||
It also compares common GoAWK one-liners and checks the pinned QuickJS command.
|
||||
The full T42 acceptance suite remains incomplete.
|
||||
The real-world tests live in `fs-tools/world-test.nu`.
|
||||
Nix packaging remains deferred until T17 merges.
|
||||
|
||||
@@ -20,13 +20,15 @@ def main [fixture: path, native_esbuild: path] {
|
||||
cp -r $fixture ($bundle | path join src app)
|
||||
let host = ($target | path join debug sausage)
|
||||
let world = ($root | path join world)
|
||||
let script = 'id; id -un; printf hello > /payload; du -b /payload; stat -c "%n %s %F %U %G" /payload; printf "2 a\n3 b\n" | awk "{sum += \$1} END {print sum}"; tar -czf /world.tgz -C / payload; qjs -e "console.log(6*7)"; esbuild /src/app/app.tsx --bundle --minify --format=iife --platform=browser --jsx=automatic --jsx-import-source=preact --legal-comments=none --log-level=error --outfile=/app.js'
|
||||
let script = 'set -e; id; id -un; printf hello > /payload; du -b /payload; stat -c "%n %s %F %U %G" /payload; printf "2 a\n3 b\n" | awk "{sum += \$1} END {print sum}"; tar -czf /world.tgz -C / payload; qjs -e "console.log(6*7)"; esbuild /src/app/app.tsx --bundle --minify --format=iife --platform=browser --jsx=automatic --jsx-import-source=preact --legal-comments=none --log-level=error --outfile=/app.js'
|
||||
let result = (^$host sh $world --userland $bundle -c $script | complete)
|
||||
print $result.stdout
|
||||
if $result.stderr != '' { print --stderr $result.stderr }
|
||||
check ($result.exit_code == 0) 'real world shell and esbuild'
|
||||
check ($result.stdout | str contains 'uid=0(root) gid=0(root) groups=0(root)') 'world root identity'
|
||||
check ($result.stdout | str contains '/payload 5 regular file root root') 'world portable stat'
|
||||
check ($result.stdout | str contains $'5(char tab)/payload') 'world apparent du'
|
||||
check ('5' in ($result.stdout | lines)) 'world awk pipeline'
|
||||
check ($result.stdout | str contains '42') 'world QuickJS'
|
||||
let native_bundle = ($root | path join native.js)
|
||||
let native = (do { cd ($bundle | path join src app); ^$native_esbuild app.tsx --bundle --minify --format=iife --platform=browser --jsx=automatic --jsx-import-source=preact --legal-comments=none --log-level=error $'--outfile=($native_bundle)' } | complete)
|
||||
|
||||
Reference in New Issue
Block a user