[107930] branches/gsoc13-tests/tests/test/trace

marius at macports.org marius at macports.org
Tue Jul 9 09:56:42 PDT 2013


Revision: 107930
          https://trac.macports.org/changeset/107930
Author:   marius at macports.org
Date:     2013-07-09 09:56:42 -0700 (Tue, 09 Jul 2013)
Log Message:
-----------
trace test: added working version.

Modified Paths:
--------------
    branches/gsoc13-tests/tests/test/trace/DESCRIPTION
    branches/gsoc13-tests/tests/test/trace/test.tcl

Removed Paths:
-------------
    branches/gsoc13-tests/tests/test/trace/Makefile
    branches/gsoc13-tests/tests/test/trace/master

Modified: branches/gsoc13-tests/tests/test/trace/DESCRIPTION
===================================================================
--- branches/gsoc13-tests/tests/test/trace/DESCRIPTION	2013-07-09 16:09:46 UTC (rev 107929)
+++ branches/gsoc13-tests/tests/test/trace/DESCRIPTION	2013-07-09 16:56:42 UTC (rev 107930)
@@ -1,3 +1,4 @@
-Trace is currently a broken test. It is intended for a feature called trace
-mode that was broken for a while now. It creates a virtual sandbox by a 
+This test checks the 'port -t' command which creates a virtual sandbox by a 
 mechanism known from Linux as library LD_PRELOADing.
+
+There is 1 test case, which looks for errors in the output file.

Deleted: branches/gsoc13-tests/tests/test/trace/Makefile
===================================================================
--- branches/gsoc13-tests/tests/test/trace/Makefile	2013-07-09 16:09:46 UTC (rev 107929)
+++ branches/gsoc13-tests/tests/test/trace/Makefile	2013-07-09 16:56:42 UTC (rev 107930)
@@ -1,37 +0,0 @@
-include ../../../Mk/macports.autoconf.mk
-
-.PHONY: test
-
-$(bindir)/port:
-	@echo "Please install MacPorts before running this test"
-	@exit 1
-
-test:
-	@PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
-	@touch delete-trace
-	@touch rename-trace
-	@mkdir -p rmdir-trace
-	@rm -f create-trace
-	@rm -f create-trace-modenv
-	@rm -rf mkdir-trace
-	@rm -f /tmp/hello-trace
-	@rm -f link-trace
-	@ln -s /usr/include/unistd.h /tmp/link-trace2
-	@PORTSRC=$(PORTSRC) $(bindir)/port -t test > output 2>&1 || (cat output; exit 1)
-	@rm -f link-trace
-	@rm -f /tmp/link-trace2
-	@rm -f delete-trace
-	@rm -f rename-trace
-	@rm -f rename-new-trace
-	@rm -f create-trace
-	@rm -f create-trace-modenv
-	@rm -rf mkdir-trace
-	@rm -rf rmdir-trace
-	@rm -f /tmp/hello-trace
-	@sed -e "s|${PWD}|PWD|g" < output > output.sed
-	@diff -u master output.sed 2>&1 | tee difference
-	@if [ -s difference ]; then \
-		exit 1; \
-	else \
-		rm -f difference output.sed; \
-	fi

Deleted: branches/gsoc13-tests/tests/test/trace/master
===================================================================
--- branches/gsoc13-tests/tests/test/trace/master	2013-07-09 16:09:46 UTC (rev 107929)
+++ branches/gsoc13-tests/tests/test/trace/master	2013-07-09 16:56:42 UTC (rev 107930)
@@ -1,12 +0,0 @@
---->  Fetching distfiles for trace
---->  Verifying checksums for trace
---->  Extracting trace
---->  Configuring trace
---->  Building trace
---->  Testing trace
-Warning: A creation/deletion/modification was attempted outside sandbox: PWD/create-trace
-Warning: A creation/deletion/modification was attempted outside sandbox: PWD/create-trace-modenv
-Warning: A creation/deletion/modification was attempted outside sandbox: PWD/delete-trace
-Warning: A creation/deletion/modification was attempted outside sandbox: PWD/mkdir-trace
-Warning: A creation/deletion/modification was attempted outside sandbox: PWD/rename-trace
-Warning: A creation/deletion/modification was attempted outside sandbox: PWD/rmdir-trace

Modified: branches/gsoc13-tests/tests/test/trace/test.tcl
===================================================================
--- branches/gsoc13-tests/tests/test/trace/test.tcl	2013-07-09 16:09:46 UTC (rev 107929)
+++ branches/gsoc13-tests/tests/test/trace/test.tcl	2013-07-09 16:56:42 UTC (rev 107930)
@@ -3,38 +3,55 @@
 
 source [file dirname $argv0]/../library.tcl
 
-#makeFile "" $output_file
+makeFile "" $output_file
 makeDirectory $work_dir
 set path [file dirname [file normalize $argv0]]
 
+load_variables $path
+
 proc test_trace {} {
     global path
+    global autoconf
+    global output_file
 
-    load_variables $path
+    set line [get_line $autoconf "runusr*"]
+    set user [lrange [split $line " "] 1 1]
+
     set_dir
     port_index
     port_clean $path
 
-    exec mkdir ../tracetesttmp
-    exec chown macports ../tracetesttmp
-    exec sudo -u macports touch  ../tracetesttmp/delete-trace
-    exec sudo -u macports touch ../tracetesttmp/rename-trace
-    exec sudo -u macports mkdir ../tracetesttmp/rmdir-trace
+
+    makeDirectory ../tracetesttmp
+    exec chown $user ../tracetesttmp
+    exec sudo -u $user touch  ../tracetesttmp/delete-trace
+    exec sudo -u $user touch ../tracetesttmp/rename-trace
+    exec sudo -u $user mkdir ../tracetesttmp/rmdir-trace
     file delete -force /tmp/hello-trace
     file link -symbolic /tmp/link-trace2 /usr/include/unistd.h
-    exec chown -h macports /tmp/link-trace2
+    exec chown -h $user /tmp/link-trace2
 
     port_trace $path
     
     file delete -force /tmp/link-trace2
     file delete -force /tmp/hello-trace
+
+    set err "error*"
+    set line [get_line $path/$output_file $err]
+    if { $line == -1 } {
+        return "No errors found."
+    } else {
+        return $line
+    }
 }
 
 test trace {
     Regression test for trace.
+} -constraints {
+    root
 } -body {
     test_trace
-} -result ""
+} -result "No errors found."
 
 
 cleanup
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130709/87c0b715/attachment.html>


More information about the macports-changes mailing list