Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: add extractor test
  • Loading branch information
rhubert committed Jan 21, 2025
commit eb8dbac9e18dcca28fda079e945f39a56103304c
Binary file added test/black-box/extractors/input/test.7z
Binary file not shown.
1 change: 1 addition & 0 deletions test/black-box/extractors/input/test.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
Binary file added test/black-box/extractors/input/test.dat.gz
Binary file not shown.
Binary file added test/black-box/extractors/input/test.dat.xz
Binary file not shown.
Binary file added test/black-box/extractors/input/test.tgz
Binary file not shown.
Binary file added test/black-box/extractors/input/test.zip
Binary file not shown.
47 changes: 47 additions & 0 deletions test/black-box/extractors/recipes/extract_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
root: True

checkoutSCM:
- scm: url
url: ${INPUT_FILES}/test.tgz
dir: tar
digestSHA256: "2fba5ef610331d7d7ac5ee7614d0c3daa78f330dc13399ddc39b2d698c63bca3"
- scm: url
url: ${INPUT_FILES}/test.dat.gz
dir: gzip
digestSHA256: "35ea2d0c6c815aed2835f41c495d9d3600e156ec561666b5c7f61112a81d6291"
if: ${IS_POSIX}
- scm: url
url: ${INPUT_FILES}/test.dat.xz
dir: xz
digestSHA256: "d81d8062ec99672a61a56a4be271d55886a63fec319dc0e00f3318a6f01b87c6"
if: ${IS_POSIX}
- scm: url
url: ${INPUT_FILES}/test.7z
dir: 7z
digestSHA256: "8bc55c46bd4d8974e99223a9f566c7f563bae2f9f8afa787e1d7df69acdf4d04"
if: ${IS_POSIX}
- scm: url
url: ${INPUT_FILES}/test.zip
dir: zip
digestSHA256: "8e2612b6ab1bacb5c0b342a81925ba6a0349ca8f66db4fc3dd22ddd53ff4f430"
- scm: url
url: ${INPUT_FILES}/test.dat
dir: plain
digestSHA256: "6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b"

depends:
- nodir

buildScript: |
cat > test.sha256 << EOF
6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b test.dat
EOF
SHA256_FILE=$(pwd)/test.sha256
for d in $(find $1/ -mindepth 1 -type d); do
pushd $d
sha256sum -c ${SHA256_FILE}
popd
done

packageScript: |
echo "success"
15 changes: 15 additions & 0 deletions test/black-box/extractors/recipes/nodir.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
checkoutSCM:
- scm: url
url: ${INPUT_FILES}/test.tgz
digestSHA256: "2fba5ef610331d7d7ac5ee7614d0c3daa78f330dc13399ddc39b2d698c63bca3"

buildScript: |
cat > test.sha256 << EOF
6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b test.dat
EOF
SHA256_FILE=$(pwd)/test.sha256
pushd $1
sha256sum -c ${SHA256_FILE}
popd

packageScript: /bin/true
17 changes: 17 additions & 0 deletions test/black-box/extractors/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -e

. ../../test-lib.sh 2>/dev/null || { echo "Must run in script directory!" ; exit 1 ; }
cleanup

INPUT=$PWD/input
test "${INPUT:0:1}" = "/"
INPUT="$(mangle_path "$INPUT")"

IS_POSIX="false"
if is_posix ; then
IS_POSIX="true"
fi

# Build and fetch result path
run_bob dev -DINPUT_FILES="${INPUT}" -DIS_POSIX="$IS_POSIX" extract_test