[26225] trunk/base/src/pextlib1.0/tests/curl.tcl

source_changes at macosforge.org source_changes at macosforge.org
Sat Jun 16 02:32:13 PDT 2007


Revision: 26225
          http://trac.macosforge.org/projects/macports/changeset/26225
Author:   eridius at macports.org
Date:     2007-06-16 02:32:11 -0700 (Sat, 16 Jun 2007)

Log Message:
-----------
Fix the curl tests

Modified Paths:
--------------
    trunk/base/src/pextlib1.0/tests/curl.tcl

Modified: trunk/base/src/pextlib1.0/tests/curl.tcl
===================================================================
--- trunk/base/src/pextlib1.0/tests/curl.tcl	2007-06-16 09:20:05 UTC (rev 26224)
+++ trunk/base/src/pextlib1.0/tests/curl.tcl	2007-06-16 09:32:11 UTC (rev 26225)
@@ -8,47 +8,37 @@
 	set tempfile /tmp/macports-pextlib-testcurl
 
 	# download a dummy file over HTTP.
-	curl fetch http://svn.macports.org/repository/macports/users/pguyot/kilroy $tempfile
+	set dummyroot http://svn.macports.org/repository/macports/users/eridius/curltest
+	curl fetch $dummyroot/dummy $tempfile
 	
 	# check the md5 sum of the file.
-	if {[md5 file $tempfile] != "a1b1cca7ffaa377e7dcdaaf2f619d8ae"} {
-		puts {[md5 file $tempfile] != "a1b1cca7ffaa377e7dcdaaf2f619d8ae"}
-		exit 1
-	}
+	test {[md5 file $tempfile] == "5421fb0f76c086a1e14bf33d25b292d4"}
 
 	# check we indeed get a 404 a dummy file over HTTP.
-	if {![catch {curl fetch http://svn.macports.org/repository/macports/users/pguyot/curl-test-404 $tempfile}]} {
-		puts {![catch {curl fetch http://svn.macports.org/repository/macports/users/pguyot/curl-test-404 $tempfile}]}
-		exit 1
-	}
+	test {[catch {curl fetch $dummyroot/404 $tempfile}]}
 	
 	# check the modification date of the dummy file.
-	# 20050801->1122822000
-	if {![curl isnewer http://svn.macports.org/repository/macports/users/pguyot/kilroy 1122822000]} {
-		puts {![curl isnewer http://svn.macports.org/repository/macports/users/pguyot/kilroy 1122822000]}
-		exit 1
-	}
-	# 20050811->1123686000
-	if {[curl isnewer http://svn.macports.org/repository/macports/users/pguyot/kilroy 1123686000]} {
-		puts {[curl isnewer http://svn.macports.org/repository/macports/users/pguyot/kilroy 1123686000]}
-		exit 1
-	}
+	set seconds [clock scan 2007-06-16Z]
+	test {[curl isnewer $dummyroot/dummy [clock scan 2007-06-16Z]]}
+	set seconds [clock scan 2007-06-17Z]
+	test {![curl isnewer $dummyroot/dummy [clock scan 2007-06-17Z]]}
 	
 	# use --disable-epsv
 	curl fetch --disable-epsv ftp://ftp.cup.hp.com/dist/networking/benchmarks/netperf/archive/netperf-2.2pl5.tar.gz $tempfile
-	if {[md5 file $tempfile] != "a4b0f4a5fbd8bec23002ad8023e01729"} {
-		puts {[md5 file $tempfile] != "a4b0f4a5fbd8bec23002ad8023e01729"}
-		exit 1
-	}
+	test {[md5 file $tempfile] == "a4b0f4a5fbd8bec23002ad8023e01729"}
 	
 	# use -u
 	curl fetch -u "I accept www.opensource.org/licenses/cpl:." http://www.research.att.com/~gsf/download/tgz/ast-ksh.2007-01-11.tgz $tempfile
-	if {[md5 file $tempfile] != "a24a0b8d8dc81600d624e3c0f2159e38"} {
-		puts {[md5 file $tempfile] != "a24a0b8d8dc81600d624e3c0f2159e38"}
-		exit 1
-	}
+	test {[md5 file $tempfile] == "a24a0b8d8dc81600d624e3c0f2159e38"}
 	
 	file delete -force $tempfile
 }
 
+proc test {args} {
+    if {[catch {uplevel 1 expr $args} result] || !$result} {
+        puts "[uplevel 1 subst -nocommands $args] == $result"
+        exit 1
+    }
+}
+
 main $argv

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070616/ba6e79df/attachment.html


More information about the macports-changes mailing list