vunify-test.sh (942B)
1 #! /bin/bash 2 3 : ${srcdir=.} 4 : ${tmptopdir=/var/tmp} 5 6 set -e 7 8 tmpdir=$(mktemp -d /var/tmp/vunify-test.XXXXXX) 9 trap "rm -rf $tmpdir" EXIT 10 11 function createFiles 12 { 13 local base=$1 14 shift 15 16 local idx=0 17 local i 18 for i; do 19 echo $i >$base$idx 20 let ++idx 21 done 22 } 23 24 function createSet 25 { 26 local base=$1 27 28 createFiles a/$base a b c d 29 createFiles b/$base a b c 30 createFiles c/$base XX XX 31 32 ln a/${base}3 b/${base}3 33 } 34 35 pushd $tmpdir &>/dev/null 36 mkdir -p {a,b,c}{/etc/sysconfig,/usr/lib,/usr/local/lib/foobar,/var/run} 37 38 createSet etc/CFG 39 createSet etc/sysconfig/CFG 40 41 createSet usr/PROG 42 createSet usr/lib/PROG 43 44 createSet usr/local/lib/LOCAL 45 createSet usr/local/lib/foobar/LOCAL 46 47 createSet var/TEMP 48 createSet var/run/TEMP 49 popd &>/dev/null 50 51 52 $D ./src/vunify -n --manually $tmpdir/a '' $tmpdir/b '' >/dev/null 53 $D ./src/vunify -n --manually $tmpdir/a '' $tmpdir/c '' >/dev/null