[111182] branches/gsoc13-tests/src/port1.0/tests
marius at macports.org
marius at macports.org
Mon Sep 16 10:42:06 PDT 2013
Revision: 111182
https://trac.macports.org/changeset/111182
Author: marius at macports.org
Date: 2013-09-16 10:42:06 -0700 (Mon, 16 Sep 2013)
Log Message:
-----------
port1.0: removed whitespaces, tabs and fixed indentation
Modified Paths:
--------------
branches/gsoc13-tests/src/port1.0/tests/portchecksum.test
branches/gsoc13-tests/src/port1.0/tests/portclean.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/portpatch.test
branches/gsoc13-tests/src/port1.0/tests/portutil.test
Modified: branches/gsoc13-tests/src/port1.0/tests/portchecksum.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portchecksum.test 2013-09-16 14:31:08 UTC (rev 111181)
+++ branches/gsoc13-tests/src/port1.0/tests/portchecksum.test 2013-09-16 17:42:06 UTC (rev 111182)
@@ -19,10 +19,10 @@
set res [portchecksum::parse_checksums $checksums_str]
if {$res != "yes"} {return "FAIL: error in checksum parse"}
if {$checksums_array(file) != "md5 1111"} {
- return "FAIL: invalid file options"
+ return "FAIL: invalid file options"
}
if {$checksums_array(file2) != "sha1 3333"} {
- return "FAIL: invalid file options"
+ return "FAIL: invalid file options"
}
return "Parse checksum successful."
} -result "Parse checksum successful."
@@ -37,7 +37,7 @@
set res [portchecksum::calc_md5 $pwd/file]
if {$res != "9f70ecc1095ff10df81be6b5f218328d"} {
- return "FAIL: unexpected md5"
+ return "FAIL: unexpected md5"
}
return "Calc md5 successful."
@@ -55,7 +55,7 @@
set res [portchecksum::calc_sha1 $pwd/file]
if {$res != "5560df60ff202ca8b8c3dcf51ad650b78e859261"} {
- return "FAIL: unexpected sha1"
+ return "FAIL: unexpected sha1"
}
return "Calc sha1 successful."
@@ -73,7 +73,7 @@
set res [portchecksum::calc_rmd160 $pwd/file]
if {$res != "5aee5d12fe536e2e288e9f1daafd84f1bc17c3e6"} {
- return "FAIL: unexpected rmd160"
+ return "FAIL: unexpected rmd160"
}
return "Calc rmd160 successful."
@@ -91,7 +91,7 @@
set res [portchecksum::calc_sha256 $pwd/file]
if {$res != "2f686816f2a80e8efcc4ef40ac4e898d27ce4205a61ee422d56f8c5e8b46612e"} {
- return "FAIL: unexpected sha1"
+ return "FAIL: unexpected sha1"
}
return "Calc sha256 successful."
@@ -110,7 +110,7 @@
set checksum.skip yes
if {[portchecksum::checksum_main] != 0} {
- return "FAIL: checksum not skipped"
+ return "FAIL: checksum not skipped"
}
set checksum.skip no
@@ -122,14 +122,15 @@
close [open $distpath/file w]
close [open $distpath/file2 w]
array set checksums_array {
- file {md5 d41d8cd98f00b204e9800998ecf8427e}
- file2 {sha1 da39a3ee5e6b4b0d3255bfef95601890afd80709}
+ file {md5 d41d8cd98f00b204e9800998ecf8427e}
+ file2 {sha1 da39a3ee5e6b4b0d3255bfef95601890afd80709}
}
if {[portchecksum::checksum_main] != 0} {
- return "FAIL: incorrect checksum"
+ return "FAIL: incorrect checksum"
}
return "Checksum main successful."
+
} -cleanup {
file delete -force $distpath
file delete -force file
Modified: branches/gsoc13-tests/src/port1.0/tests/portclean.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portclean.test 2013-09-16 14:31:08 UTC (rev 111181)
+++ branches/gsoc13-tests/src/port1.0/tests/portclean.test 2013-09-16 17:42:06 UTC (rev 111182)
@@ -28,7 +28,7 @@
set prefix /opt/local
seteuid 333
if {[catch {clean_start args}] != 1} {
- return "FAIL: couldn't elevate privileges"
+ return "FAIL: couldn't elevate privileges"
}
seteuid 0
return "Clean_start successful."
@@ -73,22 +73,22 @@
portclean::clean_dist
if {[file exists $distpath/dist_file]} {
- return "FAIL: distfile not removed"
+ return "FAIL: distfile not removed"
}
if {[file exists $distpath/dist_file2]} {
- return "FAIL: distfile not removed"
+ return "FAIL: distfile not removed"
}
if {[file exists $altprefix$distpath/dist_file2]} {
- return "FAIL: alt distfile not removed"
+ return "FAIL: alt distfile not removed"
}
if {[file exists $patchpath/patch_file2]} {
- return "FAIL: patchfile not removed"
+ return "FAIL: patchfile not removed"
}
if {[file exists $altprefix$patchpath/patch_file2]} {
- return "FAIL: alt patchfile not removed"
+ return "FAIL: alt patchfile not removed"
}
if {[file exists $portdbpath/distfiles/$dist_subdir]} {
- return "FAIL: distfiles dir not removed"
+ return "FAIL: distfiles dir not removed"
}
return "Clean distfiles successful."
@@ -124,16 +124,16 @@
portclean::clean_work
if {[file exists $subbuildpath]} {
- return "FAIL: buildpath not removed"
+ return "FAIL: buildpath not removed"
}
if {[file exists $altprefix/subbuild]} {
- return "FAIL: subbuild not removed"
+ return "FAIL: subbuild not removed"
}
if {[file exists $worksymlink]} {
- return "FAIL: symlink not removed"
+ return "FAIL: symlink not removed"
}
if {[file exists $altprefix$portpath]} {
- return "FAIL: port dir in alt prefix not removed"
+ return "FAIL: port dir in alt prefix not removed"
}
return "Clean work successful."
@@ -162,7 +162,7 @@
portclean::clean_logs
if {[file exists $subport]} {
- return "FAIL: log dir not removed"
+ return "FAIL: log dir not removed"
}
return "Clean logs successful."
@@ -180,7 +180,7 @@
set portdbpath $pwd/dbpath
file mkdir $portdbpath/incoming
- close [open $portdbpath/incoming/test.clean w+]
+ close [open $portdbpath/incoming/test.clean w+]
close [open $portdbpath/incoming/subport-1_0.0.0.0.TMP w+]
# create zip
@@ -194,13 +194,13 @@
errorChannel [open /dev/null w]
if {[file exists $portdbpath/incoming/subport-1_0.0.0.0.TMP]} {
- return "FAIL: .TMP file not removed"
+ return "FAIL: .TMP file not removed"
}
if {![file exists $portdbpath/incoming/test.clean]} {
- return "FAIL: removed unrelated file"
+ return "FAIL: removed unrelated file"
}
if {[file exists $portdbpath/incoming/subport-2_0.0.0.0.zip]} {
- return "FAIL: zip archive not removed"
+ return "FAIL: zip archive not removed"
}
return "Clean archive successful."
Modified: branches/gsoc13-tests/src/port1.0/tests/portinstall.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portinstall.test 2013-09-16 14:31:08 UTC (rev 111181)
+++ branches/gsoc13-tests/src/port1.0/tests/portinstall.test 2013-09-16 17:42:06 UTC (rev 111182)
@@ -95,7 +95,7 @@
test install_start {
Install start unit test.
-} -setup {
+} -setup {
set portvariants {var1}
set prefix prefix
set add_users no
@@ -118,12 +118,12 @@
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]
@@ -175,7 +175,7 @@
Install main unit test.
} -constraints {
root
-
+
} -setup {
set portpath $pwd
set portdbpath $pwd/dbpath
Modified: branches/gsoc13-tests/src/port1.0/tests/portload.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portload.test 2013-09-16 14:31:08 UTC (rev 111181)
+++ branches/gsoc13-tests/src/port1.0/tests/portload.test 2013-09-16 17:42:06 UTC (rev 111182)
@@ -21,7 +21,7 @@
Load main unit test.
} -constraints {
root
-
+
} -setup {
set path /Library/test/files
file mkdir $path
Modified: branches/gsoc13-tests/src/port1.0/tests/portpatch.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portpatch.test 2013-09-16 14:31:08 UTC (rev 111181)
+++ branches/gsoc13-tests/src/port1.0/tests/portpatch.test 2013-09-16 17:42:06 UTC (rev 111182)
@@ -61,12 +61,11 @@
} -body {
if {[$workername eval eval_targets patch]} {
- return "FAIL: cannot run patch"
+ return "FAIL: cannot run patch"
}
if {![file exists $pwd/work/fondu-060102/test_patch]} {
- return "FAIL: missing patched file"
+ return "FAIL: missing patched file"
}
-
return "Patch successful."
} -cleanup {
Modified: branches/gsoc13-tests/src/port1.0/tests/portutil.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portutil.test 2013-09-16 14:31:08 UTC (rev 111181)
+++ branches/gsoc13-tests/src/port1.0/tests/portutil.test 2013-09-16 17:42:06 UTC (rev 111182)
@@ -55,22 +55,22 @@
file copy -force $pwd/Portfile /tmp/
set mport [mportopen file://.]
-
+
proc getportbuildpath {id {portname ""}} {
- global portdbpath
- regsub {://} $id {.} port_path
- regsub -all {/} $port_path {_} port_path
- return [file join $portdbpath build $port_path $portname]
+ global portdbpath
+ regsub {://} $id {.} port_path
+ regsub -all {/} $port_path {_} port_path
+ return [file join $portdbpath build $port_path $portname]
}
-
+
proc getportworkpath_from_buildpath {portbuildpath} {
- return [file join $portbuildpath work]
+ return [file join $portbuildpath work]
}
-
+
proc getportworkpath_from_portdir {portpath {portname ""}} {
- return [getportworkpath_from_buildpath [getportbuildpath $portpath $portname]]
+ return [getportworkpath_from_buildpath [getportbuildpath $portpath $portname]]
}
-
+
source $pwd/../portutil.tcl
source $pwd/../portmain.tcl
@@ -132,7 +132,6 @@
} -body {
if {[handle_option vara a] != "a"} {return "FAIL: unable to set var"}
return "Handle_option successful."
-
} -result "Handle_option successful."
@@ -144,7 +143,6 @@
if {[lsearch $user_options varc] < 0} {return "FAIL: var not appended"}
if {[lsearch $user_options vard] >= 0} {return "FAIL: unappended var found"}
return "Handle_option-append successful."
-
} -result "Handle_option-append successful."
@@ -156,21 +154,19 @@
if {[lsearch $user_options varb] > 0} {return "FAIL: var not deleted"}
if {[lsearch $user_options vara] < 0} {return "FAIL: var not found"}
return "Handle_option-delete successful."
-
} -result "Handle_option-delete successful."
test handle_option-strsed {
Handle_option strsed unit test.
} -body {
- set user_options {u1 u2}
- array set option_procs {o1 1 o2 2}
- #handle_option-strsed 0 a b c
- #puts $user_options
+ unset user_options
+ array set user_options { opt options }
+ if {[handle_option-strsed opt b] != ""} {return "FAIL: invalid result"}
+ return "Handle_option-strsed successful."
+} -result "Handle_option-strsed successful."
-} -result ""
-
# test handle_option-replace # deprecated
@@ -259,7 +255,6 @@
if {[ldelete $list a] != {b a}} { return "FAIL: first element not removed" }
if {[ldelete $empty a] != {}} { return "FAIL: list was empty" }
return "ldelete successful."
-
} -result "ldelete successful."
@@ -291,7 +286,7 @@
catch {set f [open $file r]}
set cont [read -nonewline $f]
if { $cont != "MacPorts reinplace unit test?" } {
- return "FAIL: reinplace no args."
+ return "FAIL: reinplace no args."
}
close $f
@@ -299,7 +294,7 @@
catch {set f [open $file r]}
set cont [read -nonewline $f]
if { $cont != "MacPorts reinplace unit testing?" } {
- return "FAIL: reinplace (-E) extended regex."
+ return "FAIL: reinplace (-E) extended regex."
}
close $f
@@ -307,7 +302,7 @@
catch {set f [open $second/file r]}
set cont [read -nonewline $f]
if { $cont != "MP reinplace unit test?" } {
- return "FAIL: reinplace (-W) relative path."
+ return "FAIL: reinplace (-W) relative path."
}
close $f
@@ -315,7 +310,7 @@
catch {set f [open $file r]}
set cont [read -nonewline $f]
if { $cont != "" } {
- return "FAIL: reinplace (-n) suppress output."
+ return "FAIL: reinplace (-n) suppress output."
}
close $f
@@ -384,10 +379,8 @@
touch $root
if {![file exists $root]} { return "FAIL: touch unsuccessful" }
-
- # touch -a -t 199912010001.01 $root
-
return "Files successfully touched."
+
} -cleanup {
file delete -force $root
} -result "Files successfully touched."
@@ -424,37 +417,37 @@
ln -s dir $root/b
ln -s a $root/b
if {[catch {file type $root/dir/a}] || [file type $root/dir/a] ne "link"} {
- return "FAIL: directory ln failed."
+ return "FAIL: directory ln failed."
}
file delete $root/dir/a
ln -s -f -h a $root/b
if {[catch {file type $root/b}] || [file type $root/b] ne "link" || [file readlink $root/b] ne "a"} {
- return "FAIL: readlink error."
+ return "FAIL: readlink error."
}
cd $root/dir
ln -s ../c
if {[catch {file type $root/dir/c}] || [file type $root/dir/c] ne "link"} {
- return "FAIL: ln failed."
+ return "FAIL: ln failed."
}
-
+
ln -s foobar $root/d
if {[catch {file type $root/d}] || [file type $root/d] ne "link" || [file readlink $root/d] ne "foobar"} {
- return "FAIL: readlink error."
+ return "FAIL: readlink error."
}
ln -s -f -h z $root/dir
if {[catch {file type $root/dir/z}] || [file type $root/dir/z] ne "link"} {
- return "FAIL: ln failed."
+ return "FAIL: ln failed."
}
-
+
ln -sf q $root/dir
if {[catch {file type $root/dir/q}] || [file type $root/dir/q] ne "link"} {
- return "FAIL: error combined ln flags."
+ return "FAIL: error combined ln flags."
}
-
return "Files successfully linked."
+
} -cleanup {
file delete -force $root
} -result "Files successfully linked."
@@ -483,50 +476,25 @@
} -body {
set list { port }
if { [unobscure_maintainers $list] != "port at macports.org" } {
- return "FAIL: invalid maintainer name"
+ return "FAIL: invalid maintainer name"
}
set list { google.com:port }
if { [unobscure_maintainers $list] != "port at google.com" } {
- return "FAIL: invalid maintainer name"
+ return "FAIL: invalid maintainer name"
}
set list { port at google.com }
if { [unobscure_maintainers $list] != "port at google.com" } {
- return "FAIL: invalid maintainer name"
+ return "FAIL: invalid maintainer name"
}
-
return "unobscure_maintainers successful."
-
} -result "unobscure_maintainers successful."
-test target_run {
- Target run unit test.
-} -setup {
- init_eval_targets
-} -body {
- #set prefix prefix
- #set workpath $pwd/work
- #set portpath $pwd/portpath
- #set path $pwd/build
- #file mkdir $path
- #target_run $mport
-} -result ""
+# test target_run
+# test recursive_collect_deps
-test recursive_collect_deps {
- Recursive dependency search for portname.
-} -setup {
- init
- global deps
- set deps {}
- namespace eval registry {
- #recursive_collect_deps fondu $deps
- }
-} -body {
-} -result ""
-
-
test eval_targets {
Evaluate targets unit test.
} -setup {
@@ -554,7 +522,7 @@
if {[$workername eval eval_targets macport] != 1} {
return "FAIL: invalid target detected"
}
- if {[$workername eval eval_targets destroot] != 0} {
+ if {[$workername eval eval_targets checksum] != 0} {
return "FAIL: valid target not detected"
}
return "Eval_targets successful."
@@ -573,7 +541,7 @@
set res [catch {get_statefile_value target $fd result}]
if {$res != 0 || $result != "org.macports.fetch"} {
- return "FAIL: invalid value"
+ return "FAIL: invalid value"
}
return "Get statefile value successful."
} -result "Get statefile value successful."
@@ -637,36 +605,39 @@
test choose_variants {
Choose variants unit test.
-} -body {
+} -setup {
init_eval_targets
array set variations { fondu + }
array set variations_neg { fondu - }
array set variations_not { fondu a }
+} -body {
set res [choose_variants $mport variations]
if {[lindex $res 1] != "" && [lindex $res 0] != "ditem_1"} {
- return "FAIL: invalid variations"
+ return "FAIL: invalid variations"
}
set res [choose_variants $mport variations_neg]
if {[lindex $res 0] != "" && [lindex $res 1] != "ditem_1"} {
- return "FAIL: invalid variations"
+ return "FAIL: invalid variations"
}
set res [choose_variants $mport variations_not]
if {[lindex $res 0] != "" && [lindex $res 1] != ""} {
- return "FAIL: invalid variations"
+ return "FAIL: invalid variations"
}
return "Choose variant successful."
} -result "Choose variant successful."
test variant_run {
- Variant run unit test. Executes proc with same anem as variant.
-} -body {
- set ditem [variant_new new-variant]
+ Variant run unit test. Executes proc with same name as variant.
+} -setup {
+ proc variant-var {} { set var test }
+ set ditem [variant_new var]
set name [ditem_key $ditem name]
+} -body {
if {[catch {variant_run $ditem}] != 0} {
- return "FAIL: unable to run variant name proc"
+ return "FAIL: unable to run variant name proc"
}
return "Variant run successful."
} -result "Variant run successful."
@@ -677,37 +648,19 @@
} -body {
set arr {c + b - d +}
if {[canonicalize_variants $arr +] != "+c+d"} {
- return "FAIL: incorrect string"
+ return "FAIL: incorrect string"
}
if {[canonicalize_variants $arr -] != "-b"} {
- return "FAIL: incorrect string"
+ return "FAIL: incorrect string"
}
return "Canonicalize variants successful."
} -result "Canonicalize variants successful."
-# test eval_variants -
+# test eval_variants
+# test check_variants
-test check_variants {
- Check variants unit test.
- Compare them with those in the statefile.
-} -body {
- set dlist {
- version 3
- }
- array set variations {
- target.run org.macports.checksum
- }
-
- puts [dlist_search dlist version 3]
-
- #set ditem [variant_new new-variant]
- #parray PortInfo
- #puts [check_variants target]
-} -result "0"
-
-
test universal_setup {
Universal setup unit test.
} -body {
@@ -715,7 +668,7 @@
set ditem [variant_new new-variant]
if {[catch {universal_setup}] != 0} {
- return "FAIL: universal variant not set"
+ return "FAIL: universal variant not set"
}
return "Universal_setup successful."
} -result "Universal_setup successful."
@@ -739,7 +692,7 @@
} -body {
set ditem [variant_new new-variant]
if {[ditem_key $ditem name] != "new-variant"} {
- return "FAIL: error building new variant"
+ return "FAIL: error building new variant"
}
return "Variant new successful."
} -result "Variant new successful."
@@ -749,16 +702,16 @@
Handle default variants unit test.
} -body {
array set variations {
- target.run org.macports.checksum
+ target.run org.macports.checksum
}
set res [handle_default_variants target set {+org -org2}]
if {[lindex $PortInfo(vinfo) 0] != "org" || [lindex $PortInfo(vinfo) 1] != "is_default +"} {
- return "FAIL: default variant not set"
+ return "FAIL: default variant not set"
}
if {[lindex $PortInfo(vinfo) 2] != "org2" || [lindex $PortInfo(vinfo) 3] != "is_default -"} {
- return "FAIL: nondefault variant not set"
+ return "FAIL: nondefault variant not set"
}
return "Handle default variant successful."
@@ -842,15 +795,15 @@
set archives [supportedArchiveTypes]
foreach archive $archives {
- if {$archive == "xar" && ![file exists ${portutil::autoconf::xar_path}]} {
- return "FAIL: xar detected but inexistent"
- }
- if {$archive == "zip" && ![file exists ${portutil::autoconf::zip_path}]} {
- return "FAIL: zip detected but inexistent"
- }
- if {$archive == "cpio" && ![file exists ${portutil::autoconf::cpio_path}]} {
- return "FAIL: cpio detected but inexistent"
- }
+ if {$archive == "xar" && ![file exists ${portutil::autoconf::xar_path}]} {
+ return "FAIL: xar detected but inexistent"
+ }
+ if {$archive == "zip" && ![file exists ${portutil::autoconf::zip_path}]} {
+ return "FAIL: zip detected but inexistent"
+ }
+ if {$archive == "cpio" && ![file exists ${portutil::autoconf::cpio_path}]} {
+ return "FAIL: cpio detected but inexistent"
+ }
}
return "Supported archives successful."
} -result "Supported archives successful."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130916/7b8ce578/attachment-0001.html>
More information about the macports-changes
mailing list