[107805] branches/gsoc13-tests/tests/test/statefile-version2-invalid

marius at macports.org marius at macports.org
Fri Jul 5 17:06:24 PDT 2013


Revision: 107805
          https://trac.macports.org/changeset/107805
Author:   marius at macports.org
Date:     2013-07-05 17:06:24 -0700 (Fri, 05 Jul 2013)
Log Message:
-----------
Added statefile-v2-invalid test.

Added Paths:
-----------
    branches/gsoc13-tests/tests/test/statefile-version2-invalid/test.tcl

Removed Paths:
-------------
    branches/gsoc13-tests/tests/test/statefile-version2-invalid/Makefile
    branches/gsoc13-tests/tests/test/statefile-version2-invalid/master

Deleted: branches/gsoc13-tests/tests/test/statefile-version2-invalid/Makefile
===================================================================
--- branches/gsoc13-tests/tests/test/statefile-version2-invalid/Makefile	2013-07-06 00:05:06 UTC (rev 107804)
+++ branches/gsoc13-tests/tests/test/statefile-version2-invalid/Makefile	2013-07-06 00:06:24 UTC (rev 107805)
@@ -1,15 +0,0 @@
-include ../../../Mk/macports.autoconf.mk
-
-.PHONY: test
-
-$(bindir)/port:
-	@echo "Please install MacPorts before running this test"
-	@exit 1
-
-test:
-	@PORTSRC=$(PORTSRC) $(bindir)/port configure >/dev/null 2>&1
-	@cp statefile work/.macports.statefile-version2-invalid.state
-	@PORTSRC=$(PORTSRC) $(bindir)/port destroot >output 2>&1 || (cat output; exit 1)
-	@diff -u master output || (echo "statefile version 2 without checksum field didn't cause a warning"; exit 1)
-	@PORTSRC=$(PORTSRC) $(bindir)/port clean >/dev/null 2>&1
-	@rm output

Deleted: branches/gsoc13-tests/tests/test/statefile-version2-invalid/master
===================================================================
--- branches/gsoc13-tests/tests/test/statefile-version2-invalid/master	2013-07-06 00:05:06 UTC (rev 107804)
+++ branches/gsoc13-tests/tests/test/statefile-version2-invalid/master	2013-07-06 00:06:24 UTC (rev 107805)
@@ -1,8 +0,0 @@
-Warning: Statefile has version 2 but didn't contain a checksum
-Portfile changed since last build; discarding previous state.
---->  Fetching distfiles for statefile-version2-invalid
---->  Verifying checksums for statefile-version2-invalid
---->  Extracting statefile-version2-invalid
---->  Configuring statefile-version2-invalid
---->  Building statefile-version2-invalid
---->  Staging statefile-version2-invalid into destroot

Added: branches/gsoc13-tests/tests/test/statefile-version2-invalid/test.tcl
===================================================================
--- branches/gsoc13-tests/tests/test/statefile-version2-invalid/test.tcl	                        (rev 0)
+++ branches/gsoc13-tests/tests/test/statefile-version2-invalid/test.tcl	2013-07-06 00:06:24 UTC (rev 107805)
@@ -0,0 +1,47 @@
+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile "" $output_file
+set path [file dirname [file normalize $argv0]]
+
+# Initial setup
+load_variables $path
+set_dir
+port_index
+port_config $path
+file copy -force $path/statefile $work_dir/.macports.statefile-version2-invalid.state
+port_desroot $path
+port_clean $path
+
+proc state_v2_invalid {warn} {
+    global path
+    global output_file
+
+    if {[string compare $warn "no"]} {
+        set msg "*warning*checksum*"
+    } else {
+        set msg "*staging*destroot*"
+    }
+
+    set line [get_line $path/$output_file $msg]
+    return $line
+}
+
+test warning_check {
+    Regression test for statefile-v2-invalid discard prev version.
+} -body {
+    state_v2_invalid yes
+} -result "warning: statefile has version 2 but didn't contain a checksum"
+
+test output_check {
+    Regression test for statefile-v2-invalid output.
+} -body {
+    state_v2_invalid no
+} -result "--->  staging statefile-version2-invalid into destroot"
+
+removeDirectory $work_dir
+
+cleanup
+cleanupTests
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130705/4d421422/attachment.html>


More information about the macports-changes mailing list