[112078] trunk/base/tests/test/library.tcl
jmr at macports.org
jmr at macports.org
Thu Oct 10 22:53:03 PDT 2013
Revision: 112078
https://trac.macports.org/changeset/112078
Author: jmr at macports.org
Date: 2013-10-10 22:53:03 -0700 (Thu, 10 Oct 2013)
Log Message:
-----------
test code cleanup
Modified Paths:
--------------
trunk/base/tests/test/library.tcl
Modified: trunk/base/tests/test/library.tcl
===================================================================
--- trunk/base/tests/test/library.tcl 2013-10-11 05:14:19 UTC (rev 112077)
+++ trunk/base/tests/test/library.tcl 2013-10-11 05:53:03 UTC (rev 112078)
@@ -9,13 +9,9 @@
# Sets $bindir variable from macports.autoconf.mk
# autogenerated file.
proc load_variables {pwd} {
- global autoconf
- global bindir
- global datadir
- global portsrc
- global cpwd
+ global autoconf bindir datadir portsrc cpwd
- if { [file exists $autoconf] == 0 } {
+ if { ![file exists $autoconf] } {
puts "ERROR: $autoconf does not exist."
exit 1
}
@@ -28,32 +24,31 @@
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
+ 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
+ file delete -force /tmp/macports-tests
+ file delete -force ${cpwd}/PortIndex ${cpwd}/PortIndex.quick
}
# Sets initial directories
proc set_dir {} {
- global datadir
- global cpwd
+ global datadir cpwd
cleanup
- file mkdir /tmp/macports-tests/ports
- file mkdir /tmp/macports-tests/opt/local/etc/macports/
- file mkdir /tmp/macports-tests/opt/local/share/
- file mkdir /tmp/macports-tests/opt/local/var/macports/receipts/
- file mkdir /tmp/macports-tests/opt/local/var/macports/registry/
- file mkdir /tmp/macports-tests/opt/local/var/macports/build/
+ 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
@@ -61,133 +56,85 @@
# Run portindex
proc port_index {} {
- global bindir
- global datadir
- global cpwd
+ global bindir datadir cpwd
# Move up 2 level to run portindex.
set path [pwd]
cd ../..
- set cmd "portindex"
+ exec ${bindir}/portindex 2>@1
- set result [eval exec $bindir$cmd 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/
- 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
- global datadir
- global portsrc
+ global bindir datadir portsrc
set back [pwd]
cd $pwd
- set env "env PORTSRC=${portsrc}"
- set cmd "port"
- set args "clean"
-
- set result [catch {eval exec $env $bindir$cmd $args 2>@1} ]
+ catch {exec env PORTSRC=${portsrc} ${bindir}/port clean 2>@1}
cd $back
}
# Runs the portfile.
proc port_run {pwd} {
- global bindir
- global datadir
- global portsrc
+ global bindir datadir portsrc
set back [pwd]
cd $pwd
- set env "env PORTSRC=${portsrc}"
- set cmd "port"
- set args "-d test"
- set output "output"
-
- set result [catch {eval exec $env $bindir$cmd $args >&output} ]
+ 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
- global datadir
- global portsrc
+ global bindir datadir portsrc
set back [pwd]
cd $pwd
- set env "env PORTSRC=${portsrc}"
- set cmd "port"
- set args "-t test"
- set output "output"
-
- set result [catch {eval exec $env $bindir$cmd $args >&output 2>@1} ]
+ 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
- global portsrc
+ global bindir portsrc
- set env "env PORTSRC=${portsrc}"
- set cmd "port"
- set args "install"
-
- set result [catch {eval exec $env $bindir$cmd $args > output 2>@1} ]
+ set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port install > output 2>@1} ]
}
# Run configure command.
proc port_config {pwd} {
- global path
- global bindir
- global portsrc
+ global path bindir portsrc
- set env "env PORTSRC=${portsrc}"
- set cmd "port"
- set args "configure"
-
- set result [catch {eval exec $env $bindir$cmd $args 2>@1} ]
+ set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port configure 2>@1} ]
}
# Run desroot command.
proc port_desroot {pwd} {
- global path
- global bindir
- global portsrc
- global work_dir
- global output_file
+ global path bindir portsrc work_dir output_file
- set env "env PORTSRC=${portsrc}"
- set cmd "port"
- set args "destroot"
-
- file copy -force $path/statefile $work_dir/.macports.statefile-unknown-version.state
+ 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
+ exec chown macports ${work_dir}/.macports.statefile-unknown-version.state
}
- set result [catch {eval exec $env $bindir$cmd $args >$output_file 2>@1} ]
+ set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port destroot >$output_file 2>@1} ]
}
# Uninstalls portfile.
proc port_uninstall {} {
- global bindir
- global portsrc
+ global bindir portsrc
- set env "env PORTSRC=${portsrc}"
- set cmd "port"
- set args "uninstall"
-
- set result [catch {eval exec $env $bindir$cmd $args > output 2>@1} ]
+ set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port uninstall > output 2>@1} ]
}
# Returns the line containint a given string
@@ -210,9 +157,7 @@
# to install a port and save the output to a file.
# Needed for the majority of regression tests.
proc initial_setup {} {
- global output_file
- global work_dir
- global path
+ global output_file work_dir path
makeFile "" $output_file
makeDirectory $work_dir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20131010/df0354cd/attachment.html>
More information about the macports-changes
mailing list