Skip to content

Instantly share code, notes, and snippets.

Created November 4, 2011 18:48
Show Gist options
  • Save anonymous/1340140 to your computer and use it in GitHub Desktop.
Save anonymous/1340140 to your computer and use it in GitHub Desktop.
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.11.1).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `#!/bin/sh' line above, then type `sh FILE'.
#
lock_dir=_sh07080
# Made on 2011-11-04 11:47 PDT by <evmar@kitten>.
# Source directory was `/home/evmar/projects/ninja/test'.
#
# Existing files will *not* be overwritten, unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 20 -rw-r--r-- a.in
# 27 -rw-r--r-- b.in
# 378 -rw-r--r-- linux.ninja
# 626 -rw-r--r-- test.sh
#
MD5SUM=${MD5SUM-md5sum}
f=`${MD5SUM} --version | egrep '^md5sum .*(core|text)utils'`
test -n "${f}" && md5check=true || md5check=false
${md5check} || \
echo 'Note: not verifying md5sums. Consider installing GNU coreutils.'
if test "X$1" = "X-c"
then keep_file=''
else keep_file=true
fi
echo=echo
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=
locale_dir=
set_echo=false
for dir in $PATH
do
if test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
case `$dir/gettext --version 2>&1 | sed 1q` in
*GNU*) gettext_dir=$dir
set_echo=true
break ;;
esac
fi
done
if ${set_echo}
then
set_echo=false
for dir in $PATH
do
if test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
set_echo=true
break
fi
done
if ${set_echo}
then
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
fi
IFS="$save_IFS"
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null
then if (echo -n test; echo 1,2,3) | grep n >/dev/null
then shar_n= shar_c='
'
else shar_n=-n shar_c= ; fi
else shar_n= shar_c='\c' ; fi
f=shar-touch.$$
st1=200112312359.59
st2=123123592001.59
st2tr=123123592001.5 # old SysV 14-char limit
st3=1231235901
if touch -am -t ${st1} ${f} >/dev/null 2>&1 && \
test ! -f ${st1} && test -f ${f}; then
shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'
elif touch -am ${st2} ${f} >/dev/null 2>&1 && \
test ! -f ${st2} && test ! -f ${st2tr} && test -f ${f}; then
shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'
elif touch -am ${st3} ${f} >/dev/null 2>&1 && \
test ! -f ${st3} && test -f ${f}; then
shar_touch='touch -am $3$4$5$6$2 "$8"'
else
shar_touch=:
echo
${echo} 'WARNING: not restoring timestamps. Consider getting and
installing GNU `touch'\'', distributed in GNU coreutils...'
echo
fi
rm -f ${st1} ${st2} ${st2tr} ${st3} ${f}
#
if test ! -d ${lock_dir} ; then :
else ${echo} "lock directory ${lock_dir} exists"
exit 1
fi
if mkdir ${lock_dir}
then ${echo} "x - created lock directory ${lock_dir}."
else ${echo} "x - failed to create lock directory ${lock_dir}."
exit 1
fi
# ============= a.in ==============
if test -n "${keep_file}" && test -f 'a.in'
then
${echo} "x - SKIPPING a.in (file already exists)"
else
${echo} "x - extracting a.in (text)"
sed 's/^X//' << 'SHAR_EOF' > 'a.in' &&
Result of the test:
SHAR_EOF
(set 20 11 11 04 11 46 15 'a.in'
eval "${shar_touch}") && \
chmod 0644 'a.in'
if test $? -ne 0
then ${echo} "restore of a.in failed"
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'a.in': 'MD5 check failed'
) << \SHAR_EOF
ff9af8692116213032bf385dd8cb4d24 a.in
SHAR_EOF
else
test `LC_ALL=C wc -c < 'a.in'` -ne 20 && \
${echo} "restoration warning: size of 'a.in' is not 20"
fi
fi
# ============= b.in ==============
if test -n "${keep_file}" && test -f 'b.in'
then
${echo} "x - SKIPPING b.in (file already exists)"
else
${echo} "x - extracting b.in (text)"
sed 's/^X//' << 'SHAR_EOF' > 'b.in' &&
Not important for the test
SHAR_EOF
(set 20 11 11 04 11 46 19 'b.in'
eval "${shar_touch}") && \
chmod 0644 'b.in'
if test $? -ne 0
then ${echo} "restore of b.in failed"
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'b.in': 'MD5 check failed'
) << \SHAR_EOF
0018e96763b6181a29b75f2fffa40502 b.in
SHAR_EOF
else
test `LC_ALL=C wc -c < 'b.in'` -ne 27 && \
${echo} "restoration warning: size of 'b.in' is not 27"
fi
fi
# ============= linux.ninja ==============
if test -n "${keep_file}" && test -f 'linux.ninja'
then
${echo} "x - SKIPPING linux.ninja (file already exists)"
else
${echo} "x - extracting linux.ninja (text)"
sed 's/^X//' << 'SHAR_EOF' > 'linux.ninja' &&
rule cxx
X command = cat $in $byproduct > $out
X
rule cxx_with_byproduct
X command = echo Test passed | tee $byproduct > $main_out
X
rule link
X command = cat $in > $out
X
build a.out: cxx a.in | b.byproduct
X byproduct=b.byproduct
X
build b.out b.byproduct: cxx_with_byproduct b.in
X main_out=b.out
X byproduct=b.byproduct
X
build result: link a.out b.out
X
build all: phony result
SHAR_EOF
(set 20 11 11 04 11 43 06 'linux.ninja'
eval "${shar_touch}") && \
chmod 0644 'linux.ninja'
if test $? -ne 0
then ${echo} "restore of linux.ninja failed"
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'linux.ninja': 'MD5 check failed'
) << \SHAR_EOF
eb00890bb551e1d042cea729ca9e6a8d linux.ninja
SHAR_EOF
else
test `LC_ALL=C wc -c < 'linux.ninja'` -ne 378 && \
${echo} "restoration warning: size of 'linux.ninja' is not 378"
fi
fi
# ============= test.sh ==============
if test -n "${keep_file}" && test -f 'test.sh'
then
${echo} "x - SKIPPING test.sh (file already exists)"
else
${echo} "x - extracting test.sh (text)"
sed 's/^X//' << 'SHAR_EOF' > 'test.sh' &&
#!/bin/sh
X
# Original contens of the byproduct file, which should not be used
echo Test failed > b.byproduct
X
# Modify a.in to trigger rebuild of a.out
sleep 1
touch a.in
X
# Delete b.out to trigger rebuild of b.out AND b.byproduct
sleep 1
rm -f b.out
# touch b.in (if input is modified instead of the output, test will pass)
X
# TEST 1
# run ninja in silent mode - show incorrect order of steps
# sleep 1
X../ninja -f linux.ninja -n -v all
X
# TEST 2
# run ninja (with multiple threads)
sleep 1
X../ninja -f linux.ninja -j 10 all
X
# a.out should contain "Test passed",
# which was added to b.byproduct during the build
cat a.out
SHAR_EOF
(set 20 11 11 04 11 44 39 'test.sh'
eval "${shar_touch}") && \
chmod 0644 'test.sh'
if test $? -ne 0
then ${echo} "restore of test.sh failed"
fi
if ${md5check}
then (
${MD5SUM} -c >/dev/null 2>&1 || ${echo} 'test.sh': 'MD5 check failed'
) << \SHAR_EOF
ebaa1156655e488fdc1b4518d14f596a test.sh
SHAR_EOF
else
test `LC_ALL=C wc -c < 'test.sh'` -ne 626 && \
${echo} "restoration warning: size of 'test.sh' is not 626"
fi
fi
if rm -fr ${lock_dir}
then ${echo} "x - removed lock directory ${lock_dir}."
else ${echo} "x - failed to remove lock directory ${lock_dir}."
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment