[darwinbuild-changes] [922] branches/PR-8817822/testing/darwintrace
source_changes at macosforge.org
source_changes at macosforge.org
Tue Feb 8 09:31:49 PST 2011
Revision: 922
http://trac.macosforge.org/projects/darwinbuild/changeset/922
Author: wsiegrist at apple.com
Date: 2011-02-08 09:31:49 -0800 (Tue, 08 Feb 2011)
Log Message:
-----------
Add redirection test to darwintrace suite
Modified Paths:
--------------
branches/PR-8817822/testing/darwintrace/run-tests.sh
Added Paths:
-----------
branches/PR-8817822/testing/darwintrace/redirection-test
Added: branches/PR-8817822/testing/darwintrace/redirection-test
===================================================================
--- branches/PR-8817822/testing/darwintrace/redirection-test (rev 0)
+++ branches/PR-8817822/testing/darwintrace/redirection-test 2011-02-08 17:31:49 UTC (rev 922)
@@ -0,0 +1,5 @@
+#!/bin/bash
+PREFIX=$1
+ROOT=$PREFIX/root
+
+/bin/cat $PREFIX/datafile
Property changes on: branches/PR-8817822/testing/darwintrace/redirection-test
___________________________________________________________________
Added: svn:executable
+ *
Modified: branches/PR-8817822/testing/darwintrace/run-tests.sh
===================================================================
--- branches/PR-8817822/testing/darwintrace/run-tests.sh 2011-02-08 01:44:31 UTC (rev 921)
+++ branches/PR-8817822/testing/darwintrace/run-tests.sh 2011-02-08 17:31:49 UTC (rev 922)
@@ -19,18 +19,23 @@
echo "INFO: Cleaning up testing area ..."
rm -rf $PREFIX
mkdir -p $PREFIX
+mkdir -p $ROOT
mkdir -p $LOGS
mkdir -p $BIN
-cp realpath $BIN/realpath
REALPATH=$BIN/realpath
+cp realpath $REALPATH
-cp exec $BIN/exec
EXEC=$BIN/exec
+cp exec $EXEC
-cp close-test $BIN/close-test
+CLOSETEST=$BIN/close-test
+cp close-test $CLOSETEST
+REDIRECTIONTEST=$BIN/redirection-test
+cp redirection-test $REDIRECTIONTEST
+
echo "========== TEST: execve() Trace =========="
for FILE in cp echo chmod date df expr hostname ls ps pwd test;
do
@@ -41,12 +46,12 @@
set -e
LOGPAT="Python\[[0-9]+\][[:space:]]execve[[:space:]]/bin/${FILE}"
C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
- test $C -eq 1
+ test $C -eq 1
done
set -e
echo "========== TEST: close() Safety =========="
-$BIN/close-test
+$CLOSETEST
echo "========== TEST: open() Trace =========="
for FILE in /System/Library/LaunchDaemons/*.plist;
@@ -55,7 +60,7 @@
RP=$($REALPATH $FILE);
LOGPAT="cat\[[0-9]+\][[:space:]]open[[:space:]]${RP}"
C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
- test $C -eq 1
+ test $C -eq 1
done
echo "========== TEST: readlink() Trace =========="
@@ -64,15 +69,33 @@
readlink $FILE
LOGPAT="readlink\[[0-9]+\][[:space:]]readlink[[:space:]]${FILE}"
C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
- test $C -eq 1
+ test $C -eq 1
done
+echo "========== TEST: Redirection =========="
+mkdir -p $ROOT/$PREFIX
+mkdir -p $ROOT/usr/lib
+cp /usr/lib/libSystem.B.dylib $ROOT/usr/lib/libSystem.B.dylib
+mkdir -p $ROOT/bin
+cp /bin/cat $ROOT/bin/cat
+echo "Outside of root" > $PREFIX/datafile
+echo "Inside of root" > $ROOT/$PREFIX/datafile
+export DARWINTRACE_REDIRECT="${ROOT}"
+export DARWIN_BUILDROOT="${ROOT}"
+$REDIRECTIONTEST $PREFIX
+unset DARWINTRACE_REDIRECT
+unset DARWIN_BUILDROOT
+# test that execve(/bin/cat) was redirected
+RP=$($REALPATH ${ROOT}/bin/cat)
+LOGPAT="bash\[[0-9]+\][[:space:]]execve[[:space:]]${RP}"
+C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
+test $C -eq 1
+# test that open(/tmp/.../datafile) does not get redirected
+# since /tmp/ is one of the redirection exceptions
+RP=$($REALPATH ${PREFIX}/datafile)
+LOGPAT="cat\[[0-9]+\][[:space:]]open[[:space:]]${RP}"
+C=$(grep -cE $LOGPAT $DARWINTRACE_LOG)
+test $C -eq 1
-#echo "========== TEST: Redirection =========="
-#cp $DARWINTRACE $ROOT/
-#DARWINTRACE_REDIRECT="${ROOT}"
-#DARWINTRACE_LOG="${LOGS}/Redirection.log"
-
-
popd >> /dev/null
echo "INFO: Done testing!"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20110208/9d304c22/attachment.html>
More information about the darwinbuild-changes
mailing list