|
| 1 | +#!/bin/bash -e |
| 2 | +. ../../test-lib.sh 2>/dev/null || { echo "Must run in script directory!" ; exit 1 ; } |
| 3 | + |
| 4 | +cleanup |
| 5 | +rm -f test_bundle.tar |
| 6 | + |
| 7 | +trap 'rm -f test_bundle.tar' EXIT |
| 8 | + |
| 9 | +# generate some input |
| 10 | +if [[ ! -d _input ]]; then |
| 11 | + mkdir -p _input |
| 12 | + pushd _input |
| 13 | + mkdir -p a b c d |
| 14 | + |
| 15 | + for x in a b c d; do |
| 16 | + dd if=/dev/urandom of=$x/test.dat bs=1M count=10 |
| 17 | + tar czf $x/test.tgz $x/test.dat |
| 18 | + done |
| 19 | + |
| 20 | + popd # _input |
| 21 | +fi |
| 22 | + |
| 23 | +run_bob dev bundle -j 5 \ |
| 24 | + -DINPUT_BASE="$PWD/_input" \ |
| 25 | + -DINPUT_A_DIGEST="$(sha1sum _input/a/test.tgz | cut -d ' ' -f 1)" \ |
| 26 | + -DINPUT_B_DIGEST="$(sha1sum _input/b/test.tgz | cut -d ' ' -f 1)" \ |
| 27 | + -DINPUT_C_DIGEST="$(sha1sum _input/c/test.tgz | cut -d ' ' -f 1)" \ |
| 28 | + -DINPUT_D_DIGEST="$(sha1sum _input/d/test.tgz | cut -d ' ' -f 1)" |
| 29 | +expect_exist dev/src/input/1/workspace/.bob-download |
| 30 | + |
| 31 | +run_bob dev bundle -j 5 \ |
| 32 | + -DINPUT_BASE="$PWD/_input" \ |
| 33 | + -DINPUT_A_DIGEST="$(sha1sum _input/a/test.tgz | cut -d ' ' -f 1)" \ |
| 34 | + -DINPUT_B_DIGEST="$(sha1sum _input/b/test.tgz | cut -d ' ' -f 1)" \ |
| 35 | + -DINPUT_C_DIGEST="$(sha1sum _input/c/test.tgz | cut -d ' ' -f 1)" \ |
| 36 | + -DINPUT_D_DIGEST="$(sha1sum _input/d/test.tgz | cut -d ' ' -f 1)" \ |
| 37 | + --bundle test_bundle.tar |
| 38 | +expect_exist test_bundle.tar |
| 39 | + |
| 40 | +cleanup |
| 41 | +rm -f test_bundle.tar |
| 42 | + |
| 43 | +run_bob dev bundle -j 5 \ |
| 44 | + -DINPUT_BASE="$PWD/_input" \ |
| 45 | + -DINPUT_A_DIGEST="$(sha1sum _input/a/test.tgz | cut -d ' ' -f 1)" \ |
| 46 | + -DINPUT_B_DIGEST="$(sha1sum _input/b/test.tgz | cut -d ' ' -f 1)" \ |
| 47 | + -DINPUT_C_DIGEST="$(sha1sum _input/c/test.tgz | cut -d ' ' -f 1)" \ |
| 48 | + -DINPUT_D_DIGEST="$(sha1sum _input/d/test.tgz | cut -d ' ' -f 1)" \ |
| 49 | + --bundle test_bundle.tar |
| 50 | +expect_exist test_bundle.tar |
| 51 | + |
| 52 | +cleanup |
| 53 | +run_bob dev bundle -j 5 \ |
| 54 | + -DINPUT_BASE="/notexisting" \ |
| 55 | + -DINPUT_A_DIGEST="$(sha1sum _input/a/test.tgz | cut -d ' ' -f 1)" \ |
| 56 | + -DINPUT_B_DIGEST="$(sha1sum _input/b/test.tgz | cut -d ' ' -f 1)" \ |
| 57 | + -DINPUT_C_DIGEST="$(sha1sum _input/c/test.tgz | cut -d ' ' -f 1)" \ |
| 58 | + -DINPUT_D_DIGEST="$(sha1sum _input/d/test.tgz | cut -d ' ' -f 1)" \ |
| 59 | + --bundle test_bundle.tar --unbundle |
| 60 | +expect_not_exist dev/src/input/1/workspace/.bob-download |
| 61 | + |
| 62 | +cleanup |
| 63 | +rm -f test_bundle.tar |
| 64 | + |
| 65 | +expect_fail run_bob dev bundle -j 5 \ |
| 66 | + -DINPUT_BASE="$PWD/_input" \ |
| 67 | + -DINPUT_A_DIGEST="$(sha1sum _input/a/test.tgz | cut -d ' ' -f 1)" \ |
| 68 | + -DINPUT_B_DIGEST="$(sha1sum _input/b/test.tgz | cut -d ' ' -f 1)" \ |
| 69 | + -DINPUT_C_DIGEST="$(sha1sum _input/c/test.tgz | cut -d ' ' -f 1)" \ |
| 70 | + -DINPUT_D_DIGEST="$(sha1sum _input/d/test.tgz | cut -d ' ' -f 1)" \ |
| 71 | + -DTEST_INDETERMINISTIC_INPUT=True \ |
| 72 | + --bundle test_bundle.tar |
0 commit comments