[120186] trunk/base

jmr at macports.org jmr at macports.org
Sun May 18 17:05:16 PDT 2014


Revision: 120186
          https://trac.macports.org/changeset/120186
Author:   jmr at macports.org
Date:     2014-05-18 17:05:16 -0700 (Sun, 18 May 2014)
Log Message:
-----------
use proper testConstraint to avoid running trace mode test on unsupported platforms, and add darwin platform constraint to a couple tests that need it

Modified Paths:
--------------
    trunk/base/configure
    trunk/base/configure.ac
    trunk/base/tests/test/trace/test.tcl
    trunk/base/tests/test/universal/test.tcl
    trunk/base/tests/test/xcodeversion/test.tcl
    trunk/base/tests/test.tcl.in

Added Paths:
-----------
    trunk/base/tests/test/library.tcl.in

Removed Paths:
-------------
    trunk/base/tests/test/library.tcl

Property Changed:
----------------
    trunk/base/tests/test/

Modified: trunk/base/configure
===================================================================
--- trunk/base/configure	2014-05-18 22:14:29 UTC (rev 120185)
+++ trunk/base/configure	2014-05-19 00:05:16 UTC (rev 120186)
@@ -11386,7 +11386,7 @@
 
 
 # Output
-ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/Makefile doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/freebsd/Makefile portmgr/dmg/postflight setupenv.bash src/Makefile src/cregistry/Makefile src/darwintracelib1.0/Makefile src/machista1.0/Makefile src/macports1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_test_autoconf.tcl src/package1.0/Makefile src/package1.0/package_test_autoconf.tcl src/pextlib1.0/Makefile src/port/Makefile src/port1.0/Makefile src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/programs/Makefile src/registry2.0/Makefile src/registry2.0/registry_autoconf.tcl tests/Makefile tests/test.tcl vendor/Makefile"
+ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/Makefile doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/freebsd/Makefile portmgr/dmg/postflight setupenv.bash src/Makefile src/cregistry/Makefile src/darwintracelib1.0/Makefile src/machista1.0/Makefile src/macports1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_test_autoconf.tcl src/package1.0/Makefile src/package1.0/package_test_autoconf.tcl src/pextlib1.0/Makefile src/port/Makefile src/port1.0/Makefile src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/programs/Makefile src/registry2.0/Makefile src/registry2.0/registry_autoconf.tcl tests/Makefile tests/test.tcl tests/test/library.tcl vendor/Makefile"
 
 
 ac_config_files="$ac_config_files src/dedup_portfiles.tcl"
@@ -12121,6 +12121,7 @@
     "src/registry2.0/registry_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/registry2.0/registry_autoconf.tcl" ;;
     "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
     "tests/test.tcl") CONFIG_FILES="$CONFIG_FILES tests/test.tcl" ;;
+    "tests/test/library.tcl") CONFIG_FILES="$CONFIG_FILES tests/test/library.tcl" ;;
     "vendor/Makefile") CONFIG_FILES="$CONFIG_FILES vendor/Makefile" ;;
     "src/dedup_portfiles.tcl") CONFIG_FILES="$CONFIG_FILES src/dedup_portfiles.tcl" ;;
     "src/images_to_archives.tcl") CONFIG_FILES="$CONFIG_FILES src/images_to_archives.tcl" ;;

Modified: trunk/base/configure.ac
===================================================================
--- trunk/base/configure.ac	2014-05-18 22:14:29 UTC (rev 120185)
+++ trunk/base/configure.ac	2014-05-19 00:05:16 UTC (rev 120186)
@@ -429,6 +429,7 @@
 	src/registry2.0/registry_autoconf.tcl
 	tests/Makefile
 	tests/test.tcl
+	tests/test/library.tcl
 	vendor/Makefile
 ])
 


Property changes on: trunk/base/tests/test
___________________________________________________________________
Added: svn:ignore
   + library.tcl


Deleted: trunk/base/tests/test/library.tcl
===================================================================
--- trunk/base/tests/test/library.tcl	2014-05-18 22:14:29 UTC (rev 120185)
+++ trunk/base/tests/test/library.tcl	2014-05-19 00:05:16 UTC (rev 120186)
@@ -1,172 +0,0 @@
-set autoconf [file dirname $argv0]/../../../Mk/macports.autoconf.mk
-eval ::tcltest::configure $::argv
-
-set output_file "output"
-set work_dir "work"
-
-# Set of procs used for testing.
-
-# Sets $bindir variable from macports.autoconf.mk
-# autogenerated file.
-proc load_variables {pwd} {
-    global autoconf bindir datadir portsrc cpwd
-
-    if { ![file exists $autoconf] } {
-        puts "ERROR: $autoconf does not exist."
-        exit 1
-    }
-
-    set cpwd [file dirname [file dirname $pwd]]
-
-    set line [get_line $autoconf "prefix*"]
-    set prefix [lrange [split $line " "] 1 1]
-
-    set line [get_line $autoconf "bindir*"]
-    set bin [lrange [split $line "/"] 1 1]
-
-    set bindir ${prefix}/${bin}
-    set datadir ${prefix}/share
-    set portsrc ${cpwd}/test-macports.conf
-
-}
-
-proc cleanup {} {
-    global cpwd
-
-    file delete -force /tmp/macports-tests
-    file delete -force ${cpwd}/PortIndex ${cpwd}/PortIndex.quick
-}
-
-# Sets initial directories
-proc set_dir {} {
-    global datadir cpwd
-
-    cleanup
-
-    file mkdir /tmp/macports-tests/ports \
-               /tmp/macports-tests/opt/local/etc/macports \
-               /tmp/macports-tests/opt/local/share \
-               /tmp/macports-tests/opt/local/var/macports/receipts \
-               /tmp/macports-tests/opt/local/var/macports/registry \
-               /tmp/macports-tests/opt/local/var/macports/build
-
-    file link -symbolic /tmp/macports-tests/opt/local/share/macports $datadir/macports
-    file link -symbolic /tmp/macports-tests/ports/test $cpwd/test
-}
-
-# Run portindex
-proc port_index {} {
-    global bindir datadir cpwd
-
-    # Move up 2 level to run portindex.
-    set path [pwd]
-    cd ../..
-    # Avoid warning about ports tree being old
-    exec sh -c {touch */*/Portfile}
-
-    exec ${bindir}/portindex 2>@1
-
-    file copy ${cpwd}/sources.conf /tmp/macports-tests/opt/local/etc/macports/
-    file copy ${cpwd}/PortIndex ${cpwd}/PortIndex.quick /tmp/macports-tests/ports/
-
-    cd $path
-}
-
-# Executes port clean.
-proc port_clean {pwd} {
-    global bindir datadir portsrc
-
-    set back [pwd]
-    cd $pwd
-
-    catch {exec env PORTSRC=${portsrc} ${bindir}/port clean 2>@1}
-    cd $back
-}
-
-# Runs the portfile.
-proc port_run {pwd} {
-    global bindir datadir portsrc
-
-    set back [pwd]
-    cd $pwd
-
-    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -d test >&output} ]
-    cd $back
-    return $result
-}
-
-# Runs port trace.
-proc port_trace {pwd} {
-    global bindir datadir portsrc
-
-    set back [pwd]
-    cd $pwd
-
-    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -t test >&output 2>@1} ]
-    cd $back
-    return $result
-}
-
-# Installs new portfile.
-proc port_install {} {
-    global bindir portsrc
-
-    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port install > output 2>@1} ]
-}
-
-# Run configure command.
-proc port_config {pwd} {
-    global path bindir portsrc
-
-    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port configure 2>@1} ]
-}
-
-# Run destroot command.
-proc port_destroot {pwd} {
-    global path bindir portsrc work_dir output_file
-
-    file copy -force ${path}/statefile ${work_dir}/.macports.statefile-unknown-version.state
-    if { [exec id -u] == 0 } {
-        exec chown macports ${work_dir}/.macports.statefile-unknown-version.state
-    }
-    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port destroot >$output_file 2>@1} ]
-}
-
-# Uninstalls portfile.
-proc port_uninstall {} {
-    global bindir portsrc
-
-    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port uninstall > output 2>@1} ]
-}
-
-# Returns the line containint a given string
-# from a given file, or -1 if nothing is found.
-proc get_line {filename lookup} {
-    set fp [open $filename r]
-
-    while {[gets $fp line] != -1} {
-        set line [string tolower $line]
-
-        if {[string match $lookup $line] != 0} {
-            close $fp
-            return $line
-        }
-    }
-    return -1
-}
-
-# This proc contains all the steps necesary
-# to install a port and save the output to a file.
-# Needed for the majority of regression tests.
-proc initial_setup {} {
-    global output_file work_dir path
-
-    makeFile "" $output_file
-    makeDirectory $work_dir
-
-    load_variables $path
-    set_dir
-    port_index
-    port_clean $path
-    port_run $path
-}

Copied: trunk/base/tests/test/library.tcl.in (from rev 120185, trunk/base/tests/test/library.tcl)
===================================================================
--- trunk/base/tests/test/library.tcl.in	                        (rev 0)
+++ trunk/base/tests/test/library.tcl.in	2014-05-19 00:05:16 UTC (rev 120186)
@@ -0,0 +1,167 @@
+eval ::tcltest::configure $::argv
+
+set output_file "output"
+set work_dir "work"
+
+# constraint for tests that should only run on Darwin
+::tcltest::testConstraint darwin [expr {"@OS_PLATFORM@" eq "darwin"}]
+
+# constraint indicating whether the platform supports trace mode
+::tcltest::testConstraint tracemode_support [expr {@TRACEMODE_SUPPORT@ != 0}]
+
+# Set of procs used for testing.
+
+# Sets $bindir variable from autoconf
+proc load_variables {pwd} {
+    global bindir datadir portsrc cpwd
+
+    set cpwd [file dirname [file dirname $pwd]]
+
+    set prefix "@prefix@"
+    set exec_prefix "@exec_prefix@"
+    set bindir "@bindir@"
+    set datadir "@datarootdir@"
+    set portsrc ${cpwd}/test-macports.conf
+
+}
+
+proc cleanup {} {
+    global cpwd
+
+    file delete -force /tmp/macports-tests
+    file delete -force ${cpwd}/PortIndex ${cpwd}/PortIndex.quick
+}
+
+# Sets initial directories
+proc set_dir {} {
+    global datadir cpwd
+
+    cleanup
+
+    file mkdir /tmp/macports-tests/ports \
+               /tmp/macports-tests/opt/local/etc/macports \
+               /tmp/macports-tests/opt/local/share \
+               /tmp/macports-tests/opt/local/var/macports/receipts \
+               /tmp/macports-tests/opt/local/var/macports/registry \
+               /tmp/macports-tests/opt/local/var/macports/build
+
+    file link -symbolic /tmp/macports-tests/opt/local/share/macports $datadir/macports
+    file link -symbolic /tmp/macports-tests/ports/test $cpwd/test
+}
+
+# Run portindex
+proc port_index {} {
+    global bindir datadir cpwd
+
+    # Move up 2 level to run portindex.
+    set path [pwd]
+    cd ../..
+    # Avoid warning about ports tree being old
+    exec sh -c {touch */*/Portfile}
+
+    exec ${bindir}/portindex 2>@1
+
+    file copy ${cpwd}/sources.conf /tmp/macports-tests/opt/local/etc/macports/
+    file copy ${cpwd}/PortIndex ${cpwd}/PortIndex.quick /tmp/macports-tests/ports/
+
+    cd $path
+}
+
+# Executes port clean.
+proc port_clean {pwd} {
+    global bindir datadir portsrc
+
+    set back [pwd]
+    cd $pwd
+
+    catch {exec env PORTSRC=${portsrc} ${bindir}/port clean 2>@1}
+    cd $back
+}
+
+# Runs the portfile.
+proc port_run {pwd} {
+    global bindir datadir portsrc
+
+    set back [pwd]
+    cd $pwd
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -d test >&output} ]
+    cd $back
+    return $result
+}
+
+# Runs port trace.
+proc port_trace {pwd} {
+    global bindir datadir portsrc
+
+    set back [pwd]
+    cd $pwd
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -t test >&output 2>@1} ]
+    cd $back
+    return $result
+}
+
+# Installs new portfile.
+proc port_install {} {
+    global bindir portsrc
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port install > output 2>@1} ]
+}
+
+# Run configure command.
+proc port_config {pwd} {
+    global path bindir portsrc
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port configure 2>@1} ]
+}
+
+# Run destroot command.
+proc port_destroot {pwd} {
+    global path bindir portsrc work_dir output_file
+
+    file copy -force ${path}/statefile ${work_dir}/.macports.statefile-unknown-version.state
+    if { [exec id -u] == 0 } {
+        exec chown macports ${work_dir}/.macports.statefile-unknown-version.state
+    }
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port destroot >$output_file 2>@1} ]
+}
+
+# Uninstalls portfile.
+proc port_uninstall {} {
+    global bindir portsrc
+
+    set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port uninstall > output 2>@1} ]
+}
+
+# Returns the line containint a given string
+# from a given file, or -1 if nothing is found.
+proc get_line {filename lookup} {
+    set fp [open $filename r]
+
+    while {[gets $fp line] != -1} {
+        set line [string tolower $line]
+
+        if {[string match $lookup $line] != 0} {
+            close $fp
+            return $line
+        }
+    }
+    return -1
+}
+
+# This proc contains all the steps necesary
+# to install a port and save the output to a file.
+# Needed for the majority of regression tests.
+proc initial_setup {} {
+    global output_file work_dir path
+
+    makeFile "" $output_file
+    makeDirectory $work_dir
+
+    load_variables $path
+    set_dir
+    port_index
+    port_clean $path
+    port_run $path
+}

Modified: trunk/base/tests/test/trace/test.tcl
===================================================================
--- trunk/base/tests/test/trace/test.tcl	2014-05-18 22:14:29 UTC (rev 120185)
+++ trunk/base/tests/test/trace/test.tcl	2014-05-19 00:05:16 UTC (rev 120186)
@@ -60,6 +60,8 @@
 
 test trace {
     Regression test for trace.
+} -constraints {
+    tracemode_support
 } -body {
     test_trace
 } -result "No errors found."

Modified: trunk/base/tests/test/universal/test.tcl
===================================================================
--- trunk/base/tests/test/universal/test.tcl	2014-05-18 22:14:29 UTC (rev 120185)
+++ trunk/base/tests/test/universal/test.tcl	2014-05-19 00:05:16 UTC (rev 120186)
@@ -38,6 +38,8 @@
 
 test universal {
     Regression test for universal variant.
+} -constraints {
+    darwin
 } -body {
     univ_test "yes"
 } -result "variants: universal"

Modified: trunk/base/tests/test/xcodeversion/test.tcl
===================================================================
--- trunk/base/tests/test/xcodeversion/test.tcl	2014-05-18 22:14:29 UTC (rev 120185)
+++ trunk/base/tests/test/xcodeversion/test.tcl	2014-05-19 00:05:16 UTC (rev 120186)
@@ -24,12 +24,16 @@
 
 test envvariables {
     Regression test for XCode version.
+} -constraints {
+    darwin
 } -body {
     xcode_ver
 } -result "xcodeversion >= 2.1"
 
 test xcode_path {
     Regression test for XCode path.
+} -constraints {
+    darwin
 } -body {
     xcode_binpath
 } -result "xcodebuildcmd = /usr/bin/xcodebuild"

Modified: trunk/base/tests/test.tcl.in
===================================================================
--- trunk/base/tests/test.tcl.in	2014-05-18 22:14:29 UTC (rev 120185)
+++ trunk/base/tests/test.tcl.in	2014-05-19 00:05:16 UTC (rev 120186)
@@ -15,13 +15,12 @@
     statefile-version2-invalid
     statefile-version2-outdated
     svn-and-patchsites
+    trace
     universal
     variants
     xcodeversion
 }
-if {@TRACEMODE_SUPPORT@ != 0} {
-	lappend test_suite trace
-}
+
 set arguments ""
 set test_name ""
 set color_out ""
@@ -29,13 +28,7 @@
 set err ""
 
 # Get tclsh path.
-set autoconf ../Mk/macports.autoconf.mk
-set fp [open $autoconf r]
-while {[gets $fp line] != -1} {
-    if {[string match "TCLSH*" $line] != 0} {
-        set tcl [lrange [split $line " "] 1 1]
-    }
-}
+set tcl "@TCLSH@"
 
 proc print_help {arg} {
     if { $arg eq "tests" } {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140518/3de42093/attachment-0001.html>


More information about the macports-changes mailing list