[Swift-commit] r4776 - in trunk/tests/language-behaviour: . cleanup
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Tue Jul 5 16:43:25 CDT 2011
Author: hategan
Date: 2011-07-05 16:43:25 -0500 (Tue, 05 Jul 2011)
New Revision: 4776
Added:
trunk/tests/language-behaviour/cleanup/
trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.check.sh
trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.out.expected
trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.swift
trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.check.sh
trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.out.expected
trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.swift
trunk/tests/language-behaviour/cleanup/021-iter-scope-cleanup.check.sh
trunk/tests/language-behaviour/cleanup/021-iter-scope-cleanup.swift
trunk/tests/language-behaviour/cleanup/031-foreach-scope-cleanup.check.sh
trunk/tests/language-behaviour/cleanup/031-foreach-scope-cleanup.swift
trunk/tests/language-behaviour/cleanup/041-if-scope-cleanup.check.sh
trunk/tests/language-behaviour/cleanup/041-if-scope-cleanup.swift
Log:
added cleanup tests
Added: trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.check.sh
===================================================================
--- trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.check.sh (rev 0)
+++ trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.check.sh 2011-07-05 21:43:25 UTC (rev 4776)
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+PREFIX="001-proc-scope-cleanup"
+
+
+if [ -n "$(find . -name "$PREFIX.*.tmp" -print -quit)" ]; then
+ echo "A temporary file wasn't removed"
+ exit 1
+fi
+
+if [ ! -f $PREFIX.t2.out ]; then
+ echo "A persistent file was removed"
+ exit 1
+fi
+
+if ! grep "Cleaning file.*$PREFIX.t1.tmp.*" $TEST_LOG; then
+ echo "Test mapper did not claim to clean t1"
+ exit 1
+fi
+
+if ! grep "Not cleaning file.*$PREFIX.t2.out.*" $TEST_LOG; then
+ echo "Test mapper did not identify t2 as persistent"
+ exit 1
+fi
+
+if ! diff $PREFIX.out $GROUP/$PREFIX.out.expected; then
+ echo "Output differs"
+ exit 1
+fi
+
+echo "Everything's ok"
+exit 0
\ No newline at end of file
Property changes on: trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.check.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.out.expected
===================================================================
--- trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.out.expected (rev 0)
+++ trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.out.expected 2011-07-05 21:43:25 UTC (rev 4776)
@@ -0,0 +1,2 @@
+f1
+f2
Added: trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.swift
===================================================================
--- trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.swift (rev 0)
+++ trunk/tests/language-behaviour/cleanup/001-proc-scope-cleanup.swift 2011-07-05 21:43:25 UTC (rev 4776)
@@ -0,0 +1,23 @@
+type file;
+
+app (file fr) generate(string msg) {
+ echo msg stdout=@filename(fr);
+}
+
+app (file fr) cat(file f1, file f2) {
+ cat @filename(f1) @filename(f2) stdout=@filename(fr);
+}
+
+(file fr) proc1() {
+ file t1 <test_mapper;file="001-proc-scope-cleanup.t1.tmp", temp="true">;
+ file t2 <test_mapper;file="001-proc-scope-cleanup.t2.out", temp="false">;
+
+ t1 = generate("f1");
+ t2 = generate("f2");
+
+ fr = cat(t1, t2);
+}
+
+file f <"001-proc-scope-cleanup.out">;
+
+f = proc1();
Added: trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.check.sh
===================================================================
--- trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.check.sh (rev 0)
+++ trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.check.sh 2011-07-05 21:43:25 UTC (rev 4776)
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+PREFIX="011-proc-scope-alias-cleanup"
+
+if [ -n "$(find . -name "$PREFIX.*.tmp" -print -quit)" ]; then
+ echo "A temporary file wasn't removed"
+ exit 1
+fi
+
+if [ ! -f $PREFIX.2.out ]; then
+ echo "A persistent file was removed"
+ exit 1
+fi
+
+if ! grep "Remapping" $TEST_LOG; then
+ echo "Test mapper did not claim to have remapped anything"
+ exit 1
+fi
+
+if ! grep "Cleaning file.*$PREFIX.1.tmp.*" $TEST_LOG; then
+ echo "Test mapper didn't clean what it should have"
+ exit 1
+fi
+
+if ! grep "Not cleaning file.*$PREFIX.2.out.*" $TEST_LOG; then
+ echo "Test mapper did not identify 2 as persistent"
+ exit 1
+fi
+
+if ! diff $PREFIX.out $GROUP/$PREFIX.out.expected; then
+ echo "Output differs"
+ exit 1
+fi
+
+echo "Everything's ok"
+exit 0
\ No newline at end of file
Property changes on: trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.check.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.out.expected
===================================================================
--- trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.out.expected (rev 0)
+++ trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.out.expected 2011-07-05 21:43:25 UTC (rev 4776)
@@ -0,0 +1,2 @@
+f1
+f2
Added: trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.swift
===================================================================
--- trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.swift (rev 0)
+++ trunk/tests/language-behaviour/cleanup/011-proc-scope-alias-cleanup.swift 2011-07-05 21:43:25 UTC (rev 4776)
@@ -0,0 +1,29 @@
+type file;
+
+app (file fr) generate(string msg) {
+ echo msg stdout=@filename(fr);
+}
+
+app (file fr) cat(file f1, file f2) {
+ cat @filename(f1) @filename(f2) stdout=@filename(fr);
+}
+
+(file fr) proc1() {
+ file t1 <test_mapper;file="011-proc-scope-alias-cleanup.1.tmp", temp="true">;
+ file t2 <test_mapper;file="011-proc-scope-alias-cleanup.2.out", temp="false">;
+
+ t1 = generate("f1");
+ t2 = generate("f2");
+
+ file t3 <test_mapper;file="011-proc-scope-alias-cleanup.3.tmp", temp="true", remappable="true">;
+ file t4 <test_mapper;file="011-proc-scope-alias-cleanup.4.tmp", temp="true", remappable="true">;
+
+ t3 = t1;
+ t4 = t2;
+
+ fr = cat(t3, t4);
+}
+
+file f <"011-proc-scope-alias-cleanup.out">;
+
+f = proc1();
Added: trunk/tests/language-behaviour/cleanup/021-iter-scope-cleanup.check.sh
===================================================================
--- trunk/tests/language-behaviour/cleanup/021-iter-scope-cleanup.check.sh (rev 0)
+++ trunk/tests/language-behaviour/cleanup/021-iter-scope-cleanup.check.sh 2011-07-05 21:43:25 UTC (rev 4776)
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+PREFIX="021-iter-scope-cleanup"
+
+if [ -n "$(find . -name "$PREFIX.*.tmp" -print -quit)" ]; then
+ echo "A temporary file wasn't removed"
+ exit 1
+fi
+
+if [ `grep "Cleaning" $TEST_LOG | wc -l` != "3" ]; then
+ echo "Wrong number of files cleaned"
+ exit 1
+fi
+
+echo "Everything's ok"
+exit 0
\ No newline at end of file
Property changes on: trunk/tests/language-behaviour/cleanup/021-iter-scope-cleanup.check.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/language-behaviour/cleanup/021-iter-scope-cleanup.swift
===================================================================
--- trunk/tests/language-behaviour/cleanup/021-iter-scope-cleanup.swift (rev 0)
+++ trunk/tests/language-behaviour/cleanup/021-iter-scope-cleanup.swift 2011-07-05 21:43:25 UTC (rev 4776)
@@ -0,0 +1,14 @@
+type file;
+
+app (file f) gen(string msg) {
+ echo msg stdout=@filename(f);
+}
+
+iterate i
+{
+ file tmp <test_mapper;file=@strcat("021-iter-scope-cleanup.", i, ".tmp"), temp="true">;
+
+ trace("Iteration", i);
+ tmp = gen(@strcat("Iteration ", i));
+} until (i > 2);
+
Added: trunk/tests/language-behaviour/cleanup/031-foreach-scope-cleanup.check.sh
===================================================================
--- trunk/tests/language-behaviour/cleanup/031-foreach-scope-cleanup.check.sh (rev 0)
+++ trunk/tests/language-behaviour/cleanup/031-foreach-scope-cleanup.check.sh 2011-07-05 21:43:25 UTC (rev 4776)
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+PREFIX="031-foreach-scope-cleanup"
+
+if [ -n "$(find . -name "$PREFIX.*.tmp" -print -quit)" ]; then
+ echo "A temporary file wasn't removed"
+ exit 1
+fi
+
+if [ `grep "Cleaning" $TEST_LOG | wc -l` != "4" ]; then
+ echo "Wrong number of files cleaned"
+ exit 1
+fi
+
+echo "Everything's ok"
+exit 0
\ No newline at end of file
Property changes on: trunk/tests/language-behaviour/cleanup/031-foreach-scope-cleanup.check.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/language-behaviour/cleanup/031-foreach-scope-cleanup.swift
===================================================================
--- trunk/tests/language-behaviour/cleanup/031-foreach-scope-cleanup.swift (rev 0)
+++ trunk/tests/language-behaviour/cleanup/031-foreach-scope-cleanup.swift 2011-07-05 21:43:25 UTC (rev 4776)
@@ -0,0 +1,12 @@
+type file;
+
+app (file f) gen(string msg) {
+ echo msg stdout=@filename(f);
+}
+
+foreach i in [0:3] {
+ file tmp <test_mapper;file=@strcat("031-foreach-scope-cleanup.", i, ".tmp"), temp="true">;
+
+ trace("Iteration", i);
+ tmp = gen(@strcat("Iteration ", i));
+}
Added: trunk/tests/language-behaviour/cleanup/041-if-scope-cleanup.check.sh
===================================================================
--- trunk/tests/language-behaviour/cleanup/041-if-scope-cleanup.check.sh (rev 0)
+++ trunk/tests/language-behaviour/cleanup/041-if-scope-cleanup.check.sh 2011-07-05 21:43:25 UTC (rev 4776)
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+PREFIX="041-if-scope-cleanup"
+
+if [ -n "$(find . -name "$PREFIX.*.tmp" -print -quit)" ]; then
+ echo "A temporary file wasn't removed"
+ exit 1
+fi
+
+if [ ! -f $PREFIX.else.1.1.out ] || [ ! -f $PREFIX.then.2.0.out ]; then
+ echo "A persistent file was removed"
+ exit 1
+fi
+
+if [ `grep "Cleaning" $TEST_LOG | wc -l` != "2" ]; then
+ echo "Wrong number of files cleaned"
+ exit 1
+fi
+
+echo "Everything's ok"
+exit 0
\ No newline at end of file
Property changes on: trunk/tests/language-behaviour/cleanup/041-if-scope-cleanup.check.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/language-behaviour/cleanup/041-if-scope-cleanup.swift
===================================================================
--- trunk/tests/language-behaviour/cleanup/041-if-scope-cleanup.swift (rev 0)
+++ trunk/tests/language-behaviour/cleanup/041-if-scope-cleanup.swift 2011-07-05 21:43:25 UTC (rev 4776)
@@ -0,0 +1,27 @@
+type file;
+
+app (file f) gen(string msg) {
+ echo msg stdout=@filename(f);
+}
+
+foreach i in [0:1] {
+
+ trace("Iteration", i);
+ if (i == 0) {
+ file tmp <test_mapper;file=@strcat("041-if-scope-cleanup.then.1.", i, ".tmp"), temp="true">;
+ tmp = gen(@strcat("Iteration ", i));
+ }
+ else {
+ file tmp <test_mapper;file=@strcat("041-if-scope-cleanup.else.1.", i, ".out"), temp="false">;
+ tmp = gen(@strcat("Iteration ", i));
+ }
+
+ if (i == 0) {
+ file tmp <test_mapper;file=@strcat("041-if-scope-cleanup.then.2.", i, ".out"), temp="false">;
+ tmp = gen(@strcat("Iteration ", i));
+ }
+ else {
+ file tmp <test_mapper;file=@strcat("041-if-scope-cleanup.else.2.", i, ".tmp"), temp="true">;
+ tmp = gen(@strcat("Iteration ", i));
+ }
+}
More information about the Swift-commit
mailing list