Revision: 107486 https://trac.macports.org/changeset/107486 Author: marius@macports.org Date: 2013-07-01 03:21:12 -0700 (Mon, 01 Jul 2013) Log Message: ----------- Added cleanup proc to library.tcl and fixed relativa paths. Modified Paths: -------------- branches/gsoc13-tests/tests/test/checksums-1/test.tcl branches/gsoc13-tests/tests/test/library.tcl Modified: branches/gsoc13-tests/tests/test/checksums-1/test.tcl =================================================================== --- branches/gsoc13-tests/tests/test/checksums-1/test.tcl 2013-07-01 08:44:24 UTC (rev 107485) +++ branches/gsoc13-tests/tests/test/checksums-1/test.tcl 2013-07-01 10:21:12 UTC (rev 107486) @@ -5,7 +5,7 @@ set file "output" set dir "work" -set path [file dirname $argv0] +set path [file dirname [file normalize $argv0]] # Useful procs proc get_md5 {filename} { @@ -41,9 +41,9 @@ } # Initial setup -load_variables -port_clean [file dirname $argv0] -port_run [file dirname $argv0] +load_variables $path +port_clean $path +port_run $path # Test cases test md5_checksum { Modified: branches/gsoc13-tests/tests/test/library.tcl =================================================================== --- branches/gsoc13-tests/tests/test/library.tcl 2013-07-01 08:44:24 UTC (rev 107485) +++ branches/gsoc13-tests/tests/test/library.tcl 2013-07-01 10:21:12 UTC (rev 107486) @@ -1,23 +1,23 @@ -set autoconf "../../../Mk/macports.autoconf.mk" +set autoconf [file dirname $argv0]/../../../Mk/macports.autoconf.mk # Set of procs used for testing. # Sets $bindir variable from macports.autoconf.mk # autogenerated file. -proc load_variables {} { +proc load_variables {pwd} { global autoconf global bindir global datadir global portsrc - global pwd + global cpwd if { [file exists $autoconf] == 0 } { - puts "$autoconf does not exist." + puts "ERROR: $autoconf does not exist." exit 1 } - set aux [expr [string length [pwd]] - 20] - set pwd [string range [pwd] 0 [expr [string last "/" [pwd] $aux] - 1]] + set aux [expr [string length $pwd] - 20] + set cpwd [string range $pwd 0 [expr [string last "/" $pwd $aux] - 1]] set line [get_line $autoconf "prefix"] set prefix [lrange [split $line " "] 1 1] @@ -27,17 +27,22 @@ set bindir $prefix/$bin/ set datadir $prefix/share - set portsrc $pwd/test-macports.conf + 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 {} { +proc set_dir {pwd} { global datadir - global pwd + global cpwd - file delete -force /tmp/macports-tests/ - file delete -force $pwd/PortIndex $pwd/PortIndex.quick + cleanup file mkdir /tmp/macports-tests/ports file mkdir /tmp/macports-tests/opt/local/etc/macports/ @@ -47,14 +52,14 @@ file mkdir /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 $pwd/test + file link -symbolic /tmp/macports-tests/ports/test $cpwd/test } # Run portindex proc port_index {} { global bindir global datadir - global pwd + global cpwd # Move up 2 level to run portindex. set path [pwd] @@ -64,37 +69,45 @@ set result [eval exec $bindir$cmd 2>@1] - file copy $pwd/sources.conf /tmp/macports-tests/opt/local/etc/macports/ - file copy $pwd/PortIndex $pwd/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 {} { +proc port_clean {pwd} { global bindir global datadir global portsrc + set back [pwd] + cd $pwd + set env "env PORTSRC=${portsrc}" set cmd "port" set args "clean" set result [eval exec $env $bindir$cmd $args 2>@1] + cd $back } # Runs the portfile. -proc port_run {} { +proc port_run {pwd} { global bindir global datadir global 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} ] + cd $back return $result }
participants (1)
-
marius@macports.org