[111075] branches/gsoc13-tests/src/port1.0/tests

marius at macports.org marius at macports.org
Sat Sep 14 00:26:16 PDT 2013


Revision: 111075
          https://trac.macports.org/changeset/111075
Author:   marius at macports.org
Date:     2013-09-14 00:26:16 -0700 (Sat, 14 Sep 2013)
Log Message:
-----------
port1.0: added porttest.test file and test target in Portfile

Modified Paths:
--------------
    branches/gsoc13-tests/src/port1.0/tests/Portfile

Added Paths:
-----------
    branches/gsoc13-tests/src/port1.0/tests/porttest.tcl

Modified: branches/gsoc13-tests/src/port1.0/tests/Portfile
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/Portfile	2013-09-14 07:19:03 UTC (rev 111074)
+++ branches/gsoc13-tests/src/port1.0/tests/Portfile	2013-09-14 07:26:16 UTC (rev 111075)
@@ -37,4 +37,6 @@
     eval xinstall -m 644 [glob ${worksrcpath}/*.1] ${destroot}${prefix}/share/man/man1/
 }
 
-test.run		yes
+test {
+    file delete -force $worksrcpath/README
+}

Added: branches/gsoc13-tests/src/port1.0/tests/porttest.tcl
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/porttest.tcl	                        (rev 0)
+++ branches/gsoc13-tests/src/port1.0/tests/porttest.tcl	2013-09-14 07:26:16 UTC (rev 111075)
@@ -0,0 +1,72 @@
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file normalize $argv0]
+set pwd [eval file join {*}[lrange [file split $pwd] 0 end-1]]
+
+#source ../../macports1.0/macports_fastload.tcl
+set portdbpath /opt/local/var/macports
+
+package require macports 1.0
+
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
+
+source ./library.tcl
+macports_worker_init
+
+package require port 1.0
+package require registry 1.0
+
+
+# test test_start
+
+test test_main {
+    Test main unit test.
+} -constraints {
+    root
+} -setup {
+    set destpath $pwd/work/destroot
+    set portbuildpath $pwd
+    set portdbpath $pwd/dbpath
+    set portpath $pwd
+
+    set mport [mportopen file://.]
+
+    # set $version var
+    set workername [ditem_key $mport workername]
+
+    # portinstall setup
+    interp alias {} _cd {} cd
+
+    # hide all output. Deactivate this for debugging!
+    set oldchannels [array get macports::channels]
+    set macports::channels(msg)    {}
+    set macports::channels(notice) {}
+
+    if {[$workername eval eval_targets install] != 0} {
+	return "FAIL: port install failed"
+    }
+
+} -body {
+    if {[$workername eval eval_targets test] != 0} {
+	return "FAIL: test target failed"
+    }
+
+    return "Test main successful."
+
+} -cleanup {
+    if {[$workername eval eval_targets uninstall] != 0} {
+    	return "FAIL: uninstall failed"
+    }
+    if {[$workername eval eval_targets clean] != 0} {
+    	return "FAIL: clean failed"
+    }
+    file delete -force $pwd/work
+
+} -result "Test main successful."
+
+
+cleanupTests
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130914/ee94219d/attachment.html>


More information about the macports-changes mailing list