[146710] trunk/base/src/macports1.0/tests

raimue at macports.org raimue at macports.org
Tue Mar 15 09:53:03 PDT 2016


Revision: 146710
          https://trac.macports.org/changeset/146710
Author:   raimue at macports.org
Date:     2016-03-15 09:53:03 -0700 (Tue, 15 Mar 2016)
Log Message:
-----------
macports1.0/tests: Move initialization of custom prefix to library

Modified Paths:
--------------
    trunk/base/src/macports1.0/tests/library.tcl
    trunk/base/src/macports1.0/tests/macports.test

Modified: trunk/base/src/macports1.0/tests/library.tcl
===================================================================
--- trunk/base/src/macports1.0/tests/library.tcl	2016-03-15 16:40:48 UTC (rev 146709)
+++ trunk/base/src/macports1.0/tests/library.tcl	2016-03-15 16:53:03 UTC (rev 146710)
@@ -63,3 +63,25 @@
     # We don't need to handle portinterp_deferred_options, they're
     # automatically handled correctly.
 }
+
+# Set up a custom environment with its own configuration
+proc init_tmp_prefix {srcpath dstpath} {
+    global env
+
+    # use custom macports.conf and sources.conf
+    makeDirectory $dstpath
+    makeDirectory $dstpath/share
+    makeDirectory $dstpath/var/macports/registry
+    set fd [open $dstpath/macports.conf w+]
+    puts $fd "portdbpath $dstpath/var/macports"
+    puts $fd "prefix $dstpath"
+    puts $fd "variants_conf $dstpath/variants.conf"
+    puts $fd "sources_conf $srcpath/sources.conf"
+    puts $fd "applications_dir $dstpath/Applications"
+    puts $fd "frameworks_dir $dstpath/Library/Frameworks"
+    close $fd
+    file link -symbolic $dstpath/share/macports $macports::autoconf::prefix/share/macports
+    close [open $dstpath/variants.conf w+]
+
+    set env(PORTSRC) $dstpath/macports.conf
+}

Modified: trunk/base/src/macports1.0/tests/macports.test
===================================================================
--- trunk/base/src/macports1.0/tests/macports.test	2016-03-15 16:40:48 UTC (rev 146709)
+++ trunk/base/src/macports1.0/tests/macports.test	2016-03-15 16:53:03 UTC (rev 146710)
@@ -12,36 +12,22 @@
 testConstraint darwin [expr {$macports::autoconf::os_platform eq "darwin"}]
 
 package require macports 1.0
+package require Thread
 
+source ./library.tcl
+
 # clean leftovers from interrupted tests
 file delete -force $pwd/tmpdir
+# use a local, temporary prefix for testing
+init_tmp_prefix $pwd $pwd/tmpdir
 
-# use custom macports.conf and sources.conf
-makeDirectory $pwd/tmpdir
-makeDirectory $pwd/tmpdir/share
-makeDirectory $pwd/tmpdir/var/macports/registry
-set fd [open $pwd/tmpdir/macports.conf w+]
-puts $fd "portdbpath $pwd/tmpdir/var/macports"
-puts $fd "prefix $pwd/tmpdir"
-puts $fd "variants_conf $pwd/tmpdir/variants.conf"
-puts $fd "sources_conf $pwd/sources.conf"
-puts $fd "applications_dir $pwd/tmpdir/Applications"
-puts $fd "frameworks_dir $pwd/tmpdir/Library/Frameworks"
-close $fd
-set env(PORTSRC) $pwd/tmpdir/macports.conf
-file link -symbolic $pwd/tmpdir/share/macports $macports::autoconf::prefix/share/macports
-close [open $pwd/tmpdir/variants.conf w+]
-
 # Debug options
 array set ui_options {}
 #set ui_options(ports_debug)   yes
 #set ui_options(ports_verbose) yes
 mportinit ui_options
 
-package require Thread
-source ./library.tcl
 
-
 test mportclose {
     Mport close unit test.
 } -setup {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160315/f7d70476/attachment.html>


More information about the macports-changes mailing list