PERFORCE change 123623 for review

Zhouyi ZHOU zhouzhouyi at FreeBSD.org
Tue Jul 17 06:34:06 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=123623

Change 123623 by zhouzhouyi at zhouzhouyi_mactest on 2007/07/17 06:33:44

	Correct the error report mechanism for mactest

Affected files ...

.. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.c#9 edit
.. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/misc.sh#8 edit
.. //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/open/02.t#2 edit

Differences ...

==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/mactest.c#9 (text+ko) ====

@@ -531,9 +531,10 @@
 		const char *serrno;
 
 		serrno = err2str(errno);
-		fprintf(stderr, "%s returned %d\n", scall->sd_name, rval);
+		printf("%s returned %d\n", scall->sd_name, rval);
 		printf("%s\n", serrno);
-		exit(1);
+		return (i);
+		//		exit(1);
 	}
 	printf("0\n");
 	return (i);
@@ -763,7 +764,7 @@
 				record_from_conf = record_from_conf->next;
 			else{
 				notgood = 1;
-				fprintf(stderr, "\n missing ...\n");
+				fprintf(stderr, "missing ...\n");
 				struct modes_or_flags *iterator1, *tmp1;
 				struct labelstrings *iterator2, *tmp2;
 				fprintf(stderr, "pid = %d ", record_from_conf->pid);

==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/misc.sh#8 (text+ko) ====

@@ -4,8 +4,10 @@
 pid=0
 pid_file="`pwd`/pidfile"
 tmp_file="`pwd`/tmp"
+tmp_file1="`pwd`/tmp1"
 mactest_conf="`pwd`/mactest.conf"
 
+
 echo ${dir} | egrep '^/' >/dev/null 2>&1
 if [ $? -eq 0 ]; then
 	maindir="${dir}/../.."
@@ -43,17 +45,42 @@
 {
 	e="${1}"
 	shift
-	${mactest} $* 2>/dev/null 1>>${tmp_file}
+
+	if [ -f ${tmp_file} ]; then
+	    rm ${tmp_file}
+	fi
+	touch ${tmp_file}
+		
+	if [ -f ${tmp_file1} ]; then
+	    rm ${tmp_file1}
+	fi
+	touch ${tmp_file1}
+
+#set equal label to above files
+	label=`getfmac "."| sed 's/\(\.:\ \)\([a-z\,\/]*\)/\2/` 
+	label1=`echo ${label}|sed 's/\/[a-z:0-9\+]*/\/equal/g`
+	setfmac ${label1} ${tmp_file} ${tmp_file1} /var/log/mactest
+
+	${mactest} $* 2>${tmp_file1} 1>>${tmp_file}
 	r=`cat ${tmp_file}|tail -1`
+	s=`cat ${tmp_file1}`
 	echo "${r}" | egrep '^'${e}'$' >/dev/null 2>&1
-	if [ $? -eq 0 ] && [ ${#r} -eq ${#e} ]; then
+	if [ $? -eq 0 ] && [ ${#r} -eq ${#e} ] && [ ${#s} -eq 0 ]; then
 		echo "ok ${ntest}"
 	else
+	    if [ ${#s} != 0 ]; then
+		echo ${s}
+	    fi
+
+	    if [ $? != 0 ] || [ ${#r} != ${#e} ]; then
 		echo ${r}
+	    fi
 		echo "not ok ${ntest}"
 	fi
 	ntest=`expr $ntest + 1`
 	rm ${tmp_file}
+	rm ${tmp_file1}
+
 }
 
 maclabelexpect()

==== //depot/projects/soc2007/zhouzhouyi_mactest_soc/regression/mactest/tests/open/02.t#2 (text+ko) ====

@@ -9,7 +9,7 @@
 dir=`dirname $0`
 . ${dir}/../misc.sh
 
-echo "1..5"
+echo "1..4"
 
 n0=`namegen`
 n1=`namegen`
@@ -25,18 +25,11 @@
 #object's effective mls level, a ESRCH is returned when signaling
 if [ "${mac_mls_support}" != "" ] ; then
 
-    if [ -f ${tmp_file} ]; then
-	rm ${tmp_file}
-    fi
-    touch ${tmp_file}
-    setfmac mls/equal ${tmp_file}
-
-
     dvplabel=`getfmac "."| sed 's/\(\.:\ \)\([a-z\,\/]*\)/\2/`
  
 #examine the label of its parent directory
     echo -n "pid = -1 mac_test_check_vnode_lookup:" > ${mactest_conf}
-    echo "biba/high(low-high),mls/10(low-high) ${devplabel}" >> ${mactest_conf}
+    echo "biba/high(low-high),mls/10(low-high) ${dvplabel}" >> ${mactest_conf}
 
 #check the label of its parent directory
     echo -n "pid = -1 mac_test_check_vnode_create:" >> ${mactest_conf}
@@ -44,7 +37,7 @@
 
 #since the mac_mls forbid the vnode create, there are no vnode label initialization
 #and vnode extattr creating.
-    setfmac "mls/equal" /var/log/mactest
+
     t=`sysctl security.mac.mls.enabled=1`
     echo "enforcing mac/mls!"
 
@@ -59,11 +52,12 @@
 
 #BLP: no read high
     echo -n "pid = -1 mac_test_check_vnode_open#VREAD:" > ${mactest_conf}
-    echo "biba/high(low-high),mls/10(low-high) biba/high,mls/10" >> ${mactest_conf}
+    echo "biba/high(low-high),mls/low(low-high) biba/high,mls/10" >> ${mactest_conf}
     mactestexpect EACCES -m ${dvplabel} -f ${mactest_conf} open ${n1} O_RDONLY
     t=`sysctl security.mac.mls.enabled=0`
     echo "disabling mac/mls!"
 
+#BLP: ok read low
 #cleanup:
 #   cd ..
     rm -fr ${n1}


More information about the p4-projects mailing list