[110852] branches/gsoc13-tests/src/port1.0/tests/portpatch.test

marius at macports.org marius at macports.org
Sun Sep 8 09:05:11 PDT 2013


Revision: 110852
          https://trac.macports.org/changeset/110852
Author:   marius at macports.org
Date:     2013-09-08 09:05:11 -0700 (Sun, 08 Sep 2013)
Log Message:
-----------
port1.0: fixed portpatch test

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

Modified: branches/gsoc13-tests/src/port1.0/tests/portpatch.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portpatch.test	2013-09-08 14:11:19 UTC (rev 110851)
+++ branches/gsoc13-tests/src/port1.0/tests/portpatch.test	2013-09-08 16:05:11 UTC (rev 110852)
@@ -6,25 +6,17 @@
 
 source ../../macports1.0/macports_fastload.tcl
 package require macports 1.0
-mportinit
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
 
-source ../portpatch.tcl
+package require portpatch
 source ../port_autoconf.tcl
+source ./library.tcl
+macports_worker_init
 
-proc findBinary {prog {autoconf_hint ""}} {
-    if {${autoconf_hint} != "" && [file executable ${autoconf_hint}]} {
-        return ${autoconf_hint}
-    } else {
-        if {[catch {set cmd_path [macports::binaryInPath ${prog}]} t] ==
 
-            return ${cmd_path}
-        } else {
-            return -code error "${result} or at its MacPorts guration time , did you move it?"
-        }
-    }
-}
-
-
 test build_getpatchtype {
     Get patch type unit test.
 } -body {
@@ -38,15 +30,17 @@
 
 test patch_main {
     Patch main unit test.
-} -body {
+} -constraints {
+    root
+} -setup {
     set macosx_version 12
 
     set subport fondu
     set filespath $pwd/files
     set distpath $pwd/dist
-    set usealtworkpath no
+    set usealtworkpath yes
     set altprefix prefix
-    set patchfiles {file1.Z}
+    set patchfiles {file1.bz2}
 
     set workpath $pwd/work
     set worksrcpath $workpath/src
@@ -55,16 +49,37 @@
     set macosx_deployment_target $pwd/deploy_target
 
     file mkdir $filespath
-    close [open $filespath/file1.Z w+]
-    close [open $filespath/file2.Z w+]
+    set fd [open $pwd/file w+]
+    puts $fd "--- README	2005-08-25 23:49:29.000000000 +0300\n+++ \
+	    README.bk	2013-09-08 18:38:42.000000000 +0300 \n@@ -1,4 +1,3 @@ \n\
+	    -BUILDING FONDU \n   Just type:\n    $ configure\n    $ make"
+    close $fd
+    if {[catch {exec tar cjf files/file1.bz2 file}]} {
+	return "FAIL: cannot create test patch"
+    }
 
-    set res [portpatch::patch_main]
-    puts $res
+    set mport [mportopen file://.]
+    set workername [ditem_key $mport workername]
 
-    return "Get patch type successful."
+} -body {
+    if {[$workername eval eval_targets patch]} {
+	return "FAIL: cannot run patch"
+    }
+    if {![file exists $pwd/work/fondu-060102/README.bk]} {
+	return "FAIL: missing patched file"
+    }
+    if {![file exists $pwd/work/fondu-060102/README.diff]} {
+	return "FAIL: missing patched file"
+    }
+
+    return "Patch successful."
+
 } -cleanup {
     file delete -force $filespath
-} -result "Get patch type successful."
+    file delete -force $pwd/file
+    file delete -force $pwd/work
 
+} -result "Patch successful."
 
+
 cleanupTests
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130908/c3d79756/attachment-0001.html>


More information about the macports-changes mailing list