[111105] branches/gsoc13-tests

marius at macports.org marius at macports.org
Sun Sep 15 05:08:59 PDT 2013


Revision: 111105
          https://trac.macports.org/changeset/111105
Author:   marius at macports.org
Date:     2013-09-15 05:08:59 -0700 (Sun, 15 Sep 2013)
Log Message:
-----------
port1.0: fixed port_autoconf path; added port_test_autoconf.tcl

Modified Paths:
--------------
    branches/gsoc13-tests/configure
    branches/gsoc13-tests/configure.ac
    branches/gsoc13-tests/src/port1.0/tests/portactivate.test
    branches/gsoc13-tests/src/port1.0/tests/portclean.test
    branches/gsoc13-tests/src/port1.0/tests/portdeactivate.test
    branches/gsoc13-tests/src/port1.0/tests/portdepends.test
    branches/gsoc13-tests/src/port1.0/tests/portdistcheck.test
    branches/gsoc13-tests/src/port1.0/tests/portinstall.test
    branches/gsoc13-tests/src/port1.0/tests/portload.test
    branches/gsoc13-tests/src/port1.0/tests/portmain.test
    branches/gsoc13-tests/src/port1.0/tests/portpatch.test
    branches/gsoc13-tests/src/port1.0/tests/portuninstall.test
    branches/gsoc13-tests/src/port1.0/tests/portutil.test

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

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

Modified: branches/gsoc13-tests/configure
===================================================================
--- branches/gsoc13-tests/configure	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/configure	2013-09-15 12:08:59 UTC (rev 111105)
@@ -10107,7 +10107,7 @@
 
 
 # Output
-ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/base.mtree doc/prefix.mtree doc/macosx.mtree doc/macports.conf doc/pubkeys.conf portmgr/freebsd/Makefile src/Makefile src/machista1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_test_autoconf.tcl src/port1.0/port_autoconf.tcl src/registry2.0/registry_autoconf.tcl src/programs/Makefile src/macports1.0/macports_fastload.tcl setupenv.bash"
+ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/base.mtree doc/prefix.mtree doc/macosx.mtree doc/macports.conf doc/pubkeys.conf portmgr/freebsd/Makefile src/Makefile src/machista1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_test_autoconf.tcl src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/registry2.0/registry_autoconf.tcl src/programs/Makefile src/macports1.0/macports_fastload.tcl setupenv.bash"
 
 
 ac_config_files="$ac_config_files src/pkg_mkindex.sh"
@@ -10819,6 +10819,7 @@
     "src/macports1.0/macports_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_autoconf.tcl" ;;
     "src/macports1.0/macports_test_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_test_autoconf.tcl" ;;
     "src/port1.0/port_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/port1.0/port_autoconf.tcl" ;;
+    "src/port1.0/port_test_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/port1.0/port_test_autoconf.tcl" ;;
     "src/registry2.0/registry_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/registry2.0/registry_autoconf.tcl" ;;
     "src/programs/Makefile") CONFIG_FILES="$CONFIG_FILES src/programs/Makefile" ;;
     "src/macports1.0/macports_fastload.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_fastload.tcl" ;;

Modified: branches/gsoc13-tests/configure.ac
===================================================================
--- branches/gsoc13-tests/configure.ac	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/configure.ac	2013-09-15 12:08:59 UTC (rev 111105)
@@ -402,6 +402,7 @@
 	src/macports1.0/macports_autoconf.tcl
 	src/macports1.0/macports_test_autoconf.tcl
 	src/port1.0/port_autoconf.tcl
+	src/port1.0/port_test_autoconf.tcl
 	src/registry2.0/registry_autoconf.tcl
 	src/programs/Makefile
 	src/macports1.0/macports_fastload.tcl

Added: branches/gsoc13-tests/src/port1.0/port_test_autoconf.tcl.in
===================================================================
--- branches/gsoc13-tests/src/port1.0/port_test_autoconf.tcl.in	                        (rev 0)
+++ branches/gsoc13-tests/src/port1.0/port_test_autoconf.tcl.in	2013-09-15 12:08:59 UTC (rev 111105)
@@ -0,0 +1,37 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
+# macports-autoconf.tcl.in
+# $Id: macports_autoconf.tcl.in 90070 2012-02-20 21:54:35Z jberry at macports.org $
+#
+# Copyright (c) 2006 - 2009, 2011 The MacPorts Project
+# Copyright (c) 2002 - 2003 Apple Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Inc. nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+namespace eval macports::autoconf {
+    variable macports_tcl_dir "@macports_tcl_dir@"
+    variable prefix "@prefix@"
+}

Modified: branches/gsoc13-tests/src/port1.0/tests/portactivate.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portactivate.test	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/src/port1.0/tests/portactivate.test	2013-09-15 12:08:59 UTC (rev 111105)
@@ -4,9 +4,8 @@
 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
-
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}
@@ -105,4 +104,4 @@
 } -result "Port activate successful."
 
 
-cleanupTests
\ No newline at end of file
+cleanupTests

Modified: branches/gsoc13-tests/src/port1.0/tests/portclean.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portclean.test	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/src/port1.0/tests/portclean.test	2013-09-15 12:08:59 UTC (rev 111105)
@@ -4,33 +4,22 @@
 set pwd [file normalize $argv0]
 set pwd [eval file join {*}[lrange [file split $pwd] 0 end-1]]
 
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/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 ./library.tcl
+macports_worker_init
+
 source ../portclean.tcl
 source ../port_autoconf.tcl
 
-proc getportlogpath {id {portname ""}} {
-    global macports::portdbpath
-    regsub {://} $id {.} port_path
-    regsub -all {/} $port_path {_} port_path
-    return [file join $portdbpath logs $port_path $portname]
-}
 
-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] == 0} {
-            return ${cmd_path}
-        } else {
-            return -code error "${result} or at its MacPorts guration time location, did you move it?"
-        }
-    }
-}
-
-# Actual test cases
-
 test clean_start {
     Clean start unit test.
 } -constraints {

Modified: branches/gsoc13-tests/src/port1.0/tests/portdeactivate.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portdeactivate.test	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/src/port1.0/tests/portdeactivate.test	2013-09-15 12:08:59 UTC (rev 111105)
@@ -4,10 +4,10 @@
 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
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+package require macports 1.0
 
-package require macports 1.0
 array set ui_options {}
 #set ui_options(ports_debug)   yes
 #set ui_options(ports_verbose) yes

Modified: branches/gsoc13-tests/src/port1.0/tests/portdepends.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portdepends.test	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/src/port1.0/tests/portdepends.test	2013-09-15 12:08:59 UTC (rev 111105)
@@ -4,9 +4,15 @@
 set pwd [file normalize $argv0]
 set pwd [eval file join {*}[lrange [file split $pwd] 0 end-1]]
 
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/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 ../portdepends.tcl
 
 

Modified: branches/gsoc13-tests/src/port1.0/tests/portdistcheck.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portdistcheck.test	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/src/port1.0/tests/portdistcheck.test	2013-09-15 12:08:59 UTC (rev 111105)
@@ -4,7 +4,8 @@
 set pwd [file normalize $argv0]
 set pwd [eval file join {*}[lrange [file split $pwd] 0 end-1]]
 
-source ../../macports1.0/macports_fastload.tcl
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
 
 array set ui_options {}
@@ -13,11 +14,11 @@
 mportinit ui_options
 
 source ./library.tcl
+macports_worker_init
+
 source ../portdistcheck.tcl
 
-macports_worker_init
 
-
 test distcheck_main {
     Distcheck main unit test.
 } -setup {

Modified: branches/gsoc13-tests/src/port1.0/tests/portinstall.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portinstall.test	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/src/port1.0/tests/portinstall.test	2013-09-15 12:08:59 UTC (rev 111105)
@@ -4,37 +4,23 @@
 set pwd [file normalize $argv0]
 set pwd [eval file join {*}[lrange [file split $pwd] 0 end-1]]
 
+source ../port_test_autoconf.tcl
+#source $macports::autoconf::macports_tcl_dir/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 ./library.tcl
+macports_worker_init
+
 source ../portinstall.tcl
 source ../../registry2.0/portuninstall.tcl
 source ../port_autoconf.tcl
 
-proc registry_exists {name version {revision 0} {variants ""}} {
-        global macports::registry.format
-        return [${macports::registry.format}::entry_exists $name $version $revision $variants]
-}
 
-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 tion, did you move it?"
-        }
-    }
-}
-
-proc uninstall_main {args} {
-    global subport version revision portvariants user_options
-    registry_uninstall::uninstall $subport $version $revision $portvariants [array get user_options]
-    return 0
-}
-
 proc run_destroot {} {
     global pwd os_platform os_version os_arch
 
@@ -92,21 +78,31 @@
     $workername eval eval_targets destroot
 }
 
+# Set env vars
+set os.platform darwin
+set macosx_version 10.8
+set os_version 12
+set os_arch i386
+set os.major 10
+set supported_archs {}
+set configure.build_arch build_arch
+set portarchivetype tgz
 
+set subport fondu
+set version 3.0
+set revision 2
+
+
 test install_start {
     Install start unit test.
-} -body {
-    if {[getuid] != 0} {return "FAIL: not root, skipping test"}
-
-    set subport subport
-    set version 1.0
-    set revision 2
+} -setup {  
     set portvariants {var1}
     set prefix prefix
     set add_users no
 
+} -body {
     if {[catch {portinstall::install_start}] != 0} {
-	return "FAIL: problem with install start"
+		return "FAIL: problem with install start"
     }
     return "Install start successful."
 } -result "Install start successful."
@@ -114,49 +110,57 @@
 
 test create_archive {
     Create archive unit test.
-} -body {
-    if {[getuid] != 0} {return "FAIL: not root, skipping test"}
+} -constraints {
+	root
+} -setup {
+	set destpath $pwd/work/destroot
+	set portbuildpath $pwd
+	set portdbpath $pwd/dbpath
+	set portpath $pwd
+	set create $pwd/create
+	
+	# destroot setup
+    file mkdir $pwd/$subport
+    file copy -force $pwd/Portfile /tmp/
+    set mport [mportopen file://.]
+	
+    # set $version var
+    set workername [ditem_key $mport workername]
 
-    set os.platform darwin
-    set macosx_version 10.8
-    set os_version 12
-    set os_arch i386
-    set os.major 10
-    set supported_archs {}
-    set configure.build_arch build_arch
-    set portarchivetype tgz
+    # run destroot
+    if {[$workername eval eval_targets destroot] != 0} {
+		return "FAIL: destroot failed"
+	}
 
-    set subport fondu
-    set version 3.0
-    set create $pwd/create
-    set portbuildpath $pwd
-    set destpath $pwd/work/destroot
-    set portpath $pwd
-    set portdbpath $pwd/dbpath
-    set portbuildpath $pwd
-    set destpath $pwd/work/destroot
+	# portinstall setup
+	interp alias {} _cd {} cd
 
-    run_destroot
+	# hide all output. Deactivate this for debugging!
+	set oldchannels [array get macports::channels]
+	set macports::channels(msg)    {}
+	set macports::channels(notice) {}
 
-    # portinstall setup
-    interp alias {} _cd {} cd
-    set macosx_deployment_target $pwd/deploy_target
-    file link -symbolic $pwd/$subport/work $pwd/work
+	if {[$workername eval eval_targets install] != 0} {
+		return "FAIL: port install failed"
+	}
 
-    if {[catch {portinstall::install_main}] != 0} {
-	return "FAIL: cannot install port"
-    }
-
+} -body {
+	puts [portinstall::create_archive $create tgz]
     if {[catch {portinstall::create_archive $create tgz}] != 0} {
-	return "FAIL: cannot create archive"
+		return "FAIL: cannot create archive"
     }
     return "Create archive successful."
 
 } -cleanup {
-    set res [uninstall_main]
+	if {[$workername eval eval_targets uninstall] != 0} {
+    	return "FAIL: uninstall failed"
+	}
+	if {[$workername eval eval_targets clean] != 0} {
+    	return "FAIL: clean failed"
+	}
+	array set macports::channels $oldchannels
+	mportclose $mport
 
-    file delete -force $create
-    file delete -force $pwd/$subport/work
     file delete -force $pwd/$subport
     file delete -force $portdbpath
     file delete -force $pwd/work
@@ -169,21 +173,10 @@
 
 test install_main {
     Install main unit test.
-} -body {
-    if {[getuid] != 0} {return "FAIL: not root, skipping test"}
-
-    set os.platform darwin
-    set macosx_version 10.8
-    set os_version 12
-    set os_arch i386
-    set os.major 10
-    set supported_archs {}
-    set configure.build_arch build_arch
-    set portarchivetype tgz
-
-    set subport fondu
-    set version 3.0
-
+} -constraints {
+	root
+	
+} -setup {
     set portpath $pwd
     set portdbpath $pwd/dbpath
     set portbuildpath $pwd
@@ -196,20 +189,28 @@
     set macosx_deployment_target $pwd/deploy_target
     file link -symbolic $pwd/$subport/work $pwd/work
 
+} -body {
     if {[portinstall::install_main] != 0} {
-	return "FAIL: cannot install port"
+		return "FAIL: cannot install port"
     }
     return "Install main successful."
 
 } -cleanup {
-    set res [uninstall_main]
+	if {[$workername eval eval_targets uninstall] != 0} {
+    	return "FAIL: uninstall failed"
+	}
+	if {[$workername eval eval_targets clean] != 0} {
+    	return "FAIL: clean failed"
+	}
+	array set macports::channels $oldchannels
 
+	mportclose $mport
+
     file delete -force $pwd/$subport/work
-    file delete -force $pwd/$subport
     file delete -force $portdbpath
     file delete -force $pwd/work
 
 } -result "Install main successful."
 
 
-cleanupTests
+cleanupTests
\ No newline at end of file

Modified: branches/gsoc13-tests/src/port1.0/tests/portload.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portload.test	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/src/port1.0/tests/portload.test	2013-09-15 12:08:59 UTC (rev 111105)
@@ -4,18 +4,25 @@
 set pwd [file normalize $argv0]
 set pwd [eval file join {*}[lrange [file split $pwd] 0 end-1]]
 
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/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 ../portload.tcl
 source ../port_autoconf.tcl
 
 
 test load_main {
     Load main unit test.
+} -constraints {
+	root
+	
 } -setup {
-    if {[getuid] != 0} {return "FAIL: not root, skipping test"}
-
     set path /Library/test/files
     file mkdir $path
 
@@ -39,7 +46,7 @@
     set startupitem.plist files/file.plist
 
     if {[portload::load_main] != ""} {
-	return "FAIL: unable to load plist"
+		return "FAIL: unable to load plist"
     }
     return "Load successful."
 

Modified: branches/gsoc13-tests/src/port1.0/tests/portmain.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portmain.test	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/src/port1.0/tests/portmain.test	2013-09-15 12:08:59 UTC (rev 111105)
@@ -4,9 +4,20 @@
 set pwd [file normalize $argv0]
 set pwd [eval file join {*}[lrange [file split $pwd] 0 end-1]]
 
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/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 ./library.tcl
+macports_worker_init
+
+source ../portmain.tcl
+
 # Set testing vars
 set os_platform darwin
 set macosx_version 10.8
@@ -15,19 +26,13 @@
 set portpath .
 set portbuildpath ./build
 
-proc getportworkpath_from_buildpath {portbuildpath} {
-    return [file join $portbuildpath work]
-}
 
-source ../portmain.tcl
-
-
 test get_default_subport {
     Get default subport unit test.
 } -body {
     set portpath path/port/subport
     if {[portmain::get_default_subport] != "subport"} {
-	return "FAIL: wrong subport"
+		return "FAIL: wrong subport"
     }
     return "Get default subport successful."
 } -result "Get default subport successful."
@@ -38,7 +43,7 @@
 } -body {
     set portpath path/port/subport
     if {[portmain::get_subbuildpath] != "./build/subport"} {
-	return "FAIL: wrong subbuildpath"
+		return "FAIL: wrong subbuildpath"
     }
     return "Get subbuild path successful."
 } -result "Get subbuild path successful."

Modified: branches/gsoc13-tests/src/port1.0/tests/portpatch.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portpatch.test	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/src/port1.0/tests/portpatch.test	2013-09-15 12:08:59 UTC (rev 111105)
@@ -4,25 +4,28 @@
 set pwd [file normalize $argv0]
 set pwd [eval file join {*}[lrange [file split $pwd] 0 end-1]]
 
-source ../../macports1.0/macports_fastload.tcl
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 package require macports 1.0
+
 array set ui_options {}
 #set ui_options(ports_debug)   yes
 #set ui_options(ports_verbose) yes
 mportinit ui_options
 
-package require portpatch
-source ../port_autoconf.tcl
 source ./library.tcl
 macports_worker_init
 
+package require portpatch
+source ../port_autoconf.tcl
 
+
 test build_getpatchtype {
     Get patch type unit test.
 } -body {
     set res [portpatch::build_getpatchtype]
     if {$res != $portutil::autoconf::patch_path} {
-	return "FAIL: wrong path"
+		return "FAIL: wrong path"
     }
     return "Get patch type successful."
 } -result "Get patch type successful."

Deleted: branches/gsoc13-tests/src/port1.0/tests/porttest.tcl
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/porttest.tcl	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/src/port1.0/tests/porttest.tcl	2013-09-15 12:08:59 UTC (rev 111105)
@@ -1,72 +0,0 @@
-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

Added: branches/gsoc13-tests/src/port1.0/tests/porttest.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/porttest.test	                        (rev 0)
+++ branches/gsoc13-tests/src/port1.0/tests/porttest.test	2013-09-15 12:08:59 UTC (rev 111105)
@@ -0,0 +1,71 @@
+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 ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
+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

Modified: branches/gsoc13-tests/src/port1.0/tests/portuninstall.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portuninstall.test	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/src/port1.0/tests/portuninstall.test	2013-09-15 12:08:59 UTC (rev 111105)
@@ -4,37 +4,22 @@
 set pwd [file normalize $argv0]
 set pwd [eval file join {*}[lrange [file split $pwd] 0 end-1]]
 
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/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 ./library.tcl
+macports_worker_init
+
 source ../portinstall.tcl
 source ../../registry2.0/portuninstall.tcl
 source ../port_autoconf.tcl
 
-proc registry_exists {name version {revision 0} {variants ""}} {
-        global macports::registry.format
-        return [${macports::registry.format}::entry_exists $name $version $revision $variants]
-}
-
-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 tion, did you move it?"
-        }
-    }
-}
-
-proc uninstall_main {args} {
-    global subport version revision portvariants user_options
-    registry_uninstall::uninstall $subport $version $revision $portvariants [array get user_options]
-    return 0
-}
-
 proc run_destroot {} {
     global pwd os_platform os_version os_arch
 
@@ -98,9 +83,10 @@
 
 test uninstall_main {
     Uninstall main unit test.
-} -body {
-    if {[getuid] != 0} {return "FAIL: not root, skipping test"}
+} -constraints {
+	root
 
+} -setup {
     set os.platform darwin
     set macosx_version 10.8
     set os_version 11
@@ -126,16 +112,16 @@
     file link -symbolic $pwd/$subport/work $pwd/work
 
     if {[portinstall::install_main] != 0} {
-	return "FAIL: cannot install port"
+		return "FAIL: cannot install port"
     }
 
+} -body {
     if {[uninstall_main] != 0} {
-	return "FAIL: cannot uninstall port"
+		return "FAIL: cannot uninstall port"
     }
     return "Uninstall main successful."
 
 } -cleanup {
-    file delete -force $pwd/$subport/work
     file delete -force $pwd/$subport
     file delete -force $portdbpath
     file delete -force $pwd/work

Modified: branches/gsoc13-tests/src/port1.0/tests/portutil.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portutil.test	2013-09-15 11:50:54 UTC (rev 111104)
+++ branches/gsoc13-tests/src/port1.0/tests/portutil.test	2013-09-15 12:08:59 UTC (rev 111105)
@@ -6,7 +6,18 @@
 set pwd [file normalize $argv0]
 set pwd [eval file join {*}[lrange [file split $pwd] 0 end-1]]
 
+source ../port_test_autoconf.tcl
+source $macports::autoconf::macports_tcl_dir/macports1.0/macports_fastload.tcl
 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 registry 1.0
 package require registry2 2.0
 package require Pextlib 1.0
@@ -14,20 +25,7 @@
 package require macports_util 1.0
 package require msgcat
 package require porttrace 1.0
-mportinit
 
-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] == 0} {
-            return ${cmd_path}
-        } else {
-            return -code error "${result} or at its MacPorts guration time location, did you move it?"
-        }
-    }
-}
-
 proc init {} {
     global macports::registry.path
 
@@ -76,8 +74,6 @@
     source $pwd/../portutil.tcl
     source $pwd/../portmain.tcl
 
-
-
     #variant provides code requires aaa
 }
 
@@ -535,11 +531,17 @@
     Evaluate targets unit test.
 } -setup {
     init_eval_targets
+	set patchfiles {file.diff}
 
+	file mkdir $filespath
+    set fd [open $filespath/file.diff w+]
+    puts $fd "first line should get to the workpath"
+    close $fd
+
     # sets up PortInfo array
     if {[eval_variants variations] != 0} {
-	mportclose $mport
-	error "Error evaluating variants"
+		mportclose $mport
+		error "Error evaluating variants"
     }
 
     set epoch $PortInfo(epoch)
@@ -549,16 +551,12 @@
     set workername [ditem_key $mport workername]
 
 } -body {
-    # skip known warnings
-    close stderr
-
-    if {[$workername eval eval_targets pre-patch] != 1} {
-	return "FAIL: invalid target detected"
+    if {[$workername eval eval_targets macport] != 1} {
+		return "FAIL: invalid target detected"
     }
     if {[$workername eval eval_targets destroot] != 0} {
-	return "FAIL: valid target not detected"
+		return "FAIL: valid target not detected"
     }
-    errorChannel [open /dev/null w]
     return "Eval_targets successful."
 
 } -cleanup {
@@ -781,7 +779,7 @@
     file mkdir $pwd/test.dir
     file copy -force $pwd/statefile $pwd/test.dir
     if {[dirSize $pwd/test.dir] != 155} {
-	return "FAIL: wrong dir size"
+		return "FAIL: wrong dir size"
     }
     return "Directory size calculated successfully."
 
@@ -817,7 +815,7 @@
 
     set res [get_portimage_name]
     if {$res != "testport-1.0_0.darwin_10.no.tgz"} {
-	return "FAIL: invalid portimage_name"
+		return "FAIL: invalid portimage_name"
     }
     return "Get portimage_name successful."
 } -result "Get portimage_name successful."
@@ -831,7 +829,7 @@
 
     set res [get_portimage_path]
     if {$res != "dbpath/software/subport/subport-1.0_0.darwin_10.no.tgz"} {
-	return "FAIL: invalid portimage_path"
+		return "FAIL: invalid portimage_path"
     }
     return "Get portimage_path successful."
 } -result "Get portimage_path successful."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130915/369cd256/attachment-0001.html>


More information about the macports-changes mailing list