[MacPorts] Tests modified

MacPorts noreply at macports.org
Mon Sep 16 11:01:14 PDT 2013


Page "Tests" was changed by marius at macports.org
Diff URL: <https://trac.macports.org/wiki/Tests?action=diff&version=13>
Revision 13
Changes:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: Tests
=========================================================================
--- Tests (version: 12)
+++ Tests (version: 13)
@@ -7,6 +7,8 @@
 Maintainer: marius [at] macports.org
 
 === Running tests ===
+
+Tests can be run only on an installed version of MacPorts (so make sure you have run 'sudo make install').
 
 The easiest way to run all the tests, is to use the target in the Makefile.
 {{{
@@ -58,7 +60,6 @@
 
 === Must know ===
 
-* the tests can be run only on an installed version of MacPorts (so make sure you have run 'sudo make install')
 * regression tests have their own directory, found in [browser:trunk/base/tests/test trunk/base/tests/test]
 * each module of MacPorts (port1.0, macports1.0, package1.0) has its own ‘tests/’ directory where the test files are located and also additional files needed ([browser:branches/gsoc13-tests/src/macports1.0/tests/Portfile Portfile], [browser:branches/gsoc13-tests/src/macports1.0/tests/test.tcl test.tcl])
 * each file in a module has a corresponding test file (.test extension) in the ‘tests/’ directory
@@ -67,6 +68,7 @@
 * each test must clean all auxiliary files or directories it creates and revert all ports it installs
 * use a single test proceduce for each tested proc; sub-test cases should be included in the same body
 * when adding new regression tests, make sure to specify its name in the test_suite list of 'trunk/base/tests/test.tcl'
+* variables used in tests can be set at install-time using the '[module]_test_autoconf.tcl.in' file in each module ([[https://trac.macports.org/browser/trunk/base/src/macports1.0/macports_autoconf.tcl.in | macports_test_autoconf.tcl.in]], [[https://trac.macports.org/browser/trunk/base/src/port1.0/port_autoconf.tcl.in | port_test_autoconf.tcl.in]])
 
 
 === Sample file ===
@@ -81,16 +83,11 @@
 set pwd [eval file join {*}[lrange [file split $pwd] 0 end-1]]
 
 # the macports_fastload.tcl file needs to be sourced so we
-# can directly require packages later on
-source ../../macports1.0/macports_fastload.tcl
-
-# debug options
-# ports_debug and ports_verbose are commented out as default
-# need to be set before ‘mportinit’
-array set ui_options {}
-#set ui_options(ports_debug)   yes
-#set ui_options(ports_verbose) yes
-mportinit ui_options
+# can directly require packages later on; we can use the autoconf
+# file to get the path to the file
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
 
 # source/require tested/needed files
 # source ../../port1.0/portutil.tcl
@@ -112,6 +109,14 @@
 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
+# ports_debug and ports_verbose are commented out as default
+# need to be set before ‘mportinit’
+array set ui_options {}
+#set ui_options(ports_debug)   yes
+#set ui_options(ports_verbose) yes
+mportinit ui_options
 
 # if you need to use procs from macports namespace, that are just aliases, you can
 # always source library.tcl (see additional files) which provides a copy macports::worker_init
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://trac.macports.org/wiki/Tests>
MacPorts <http://www.macports.org/>
Ports system for OS X

This is an automated message. Someone added your email address to be
notified of changes on 'Tests' page.
If it was not you, please report to .


More information about the macports-changes mailing list