[Swift-commit] r5072 - trunk/tests/apps
wozniak at ci.uchicago.edu
wozniak at ci.uchicago.edu
Tue Sep 6 09:50:24 CDT 2011
Author: wozniak
Date: 2011-09-06 09:50:24 -0500 (Tue, 06 Sep 2011)
New Revision: 5072
Added:
trunk/tests/apps/050-stomp-skel-1.args
trunk/tests/apps/050-stomp-skel-1.clean.sh
trunk/tests/apps/050-stomp-skel-1.setup.sh
trunk/tests/apps/050-stomp-skel-1.swift
trunk/tests/apps/050-stomp-skel-2.args
trunk/tests/apps/050-stomp-skel-2.setup.sh
trunk/tests/apps/050-stomp-skel-2.swift
trunk/tests/apps/STOMP.txt
trunk/tests/apps/gpg.sh
trunk/tests/apps/pg.sh
trunk/tests/apps/sph.sh
trunk/tests/apps/stomp.sh
Log:
Check in test cases based on STOMP application
Added: trunk/tests/apps/050-stomp-skel-1.args
===================================================================
--- trunk/tests/apps/050-stomp-skel-1.args (rev 0)
+++ trunk/tests/apps/050-stomp-skel-1.args 2011-09-06 14:50:24 UTC (rev 5072)
@@ -0,0 +1 @@
+-iters=4
Added: trunk/tests/apps/050-stomp-skel-1.clean.sh
===================================================================
--- trunk/tests/apps/050-stomp-skel-1.clean.sh (rev 0)
+++ trunk/tests/apps/050-stomp-skel-1.clean.sh 2011-09-06 14:50:24 UTC (rev 5072)
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -x
+
+rm -v data-*.txt || exit 1
+
+exit 0
Property changes on: trunk/tests/apps/050-stomp-skel-1.clean.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/apps/050-stomp-skel-1.setup.sh
===================================================================
--- trunk/tests/apps/050-stomp-skel-1.setup.sh (rev 0)
+++ trunk/tests/apps/050-stomp-skel-1.setup.sh 2011-09-06 14:50:24 UTC (rev 5072)
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -x
+
+touch data-0.txt || exit 1
+
+exit 0
Property changes on: trunk/tests/apps/050-stomp-skel-1.setup.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/apps/050-stomp-skel-1.swift
===================================================================
--- trunk/tests/apps/050-stomp-skel-1.swift (rev 0)
+++ trunk/tests/apps/050-stomp-skel-1.swift 2011-09-06 14:50:24 UTC (rev 5072)
@@ -0,0 +1,23 @@
+
+type file;
+
+app (file output) model(file input)
+{
+ cp @input @output;
+}
+
+int iterations = @toint(@arg("iters"));
+
+file inputs[];
+file input0<"data-0.txt">;
+tracef("starting with: %M\n", input0);
+inputs[0] = input0;
+
+iterate iter {
+ tracef("iter: %i\n", iter);
+ string output_name = @strcat("data-", iter+1, ".txt");
+ tracef("output_name: %s\n", output_name);
+ file output<single_file_mapper;file=output_name>;
+ output = model(inputs[iter]);
+ inputs[iter+1] = output;
+} until (iter > iterations);
Added: trunk/tests/apps/050-stomp-skel-2.args
===================================================================
--- trunk/tests/apps/050-stomp-skel-2.args (rev 0)
+++ trunk/tests/apps/050-stomp-skel-2.args 2011-09-06 14:50:24 UTC (rev 5072)
@@ -0,0 +1 @@
+-iters=4
Added: trunk/tests/apps/050-stomp-skel-2.setup.sh
===================================================================
--- trunk/tests/apps/050-stomp-skel-2.setup.sh (rev 0)
+++ trunk/tests/apps/050-stomp-skel-2.setup.sh 2011-09-06 14:50:24 UTC (rev 5072)
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -x
+
+touch data-0.txt || exit 1
+
+exit 0
Property changes on: trunk/tests/apps/050-stomp-skel-2.setup.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/apps/050-stomp-skel-2.swift
===================================================================
--- trunk/tests/apps/050-stomp-skel-2.swift (rev 0)
+++ trunk/tests/apps/050-stomp-skel-2.swift 2011-09-06 14:50:24 UTC (rev 5072)
@@ -0,0 +1,73 @@
+
+type file;
+
+app (file output) stomp(file input)
+{
+ stomp @input @output;
+}
+
+// Creates the output and a few files named directory/pg-*.out
+app (file output, file index) pg(file input, string directory)
+{
+ pg @input directory @output @index;
+}
+
+app (file output) sph(file tarfile, string entry)
+{
+ sph @tarfile @entry @output;
+}
+
+app (file output) gpg(file input[])
+{
+ // Put output first for easier command-line processing
+ gpg @output @input;
+}
+
+(file output) model(file input, int iter)
+{
+ tracef("model input: %M\n", input);
+ string directory = @strcat("run-", iter);
+ tracef("directory: %s\n", directory);
+ string stomp_out_name = @strcat(directory, "/stomp.out");
+ tracef("stomp_out_name: %s\n", stomp_out_name);
+ file stomp_out<single_file_mapper;file=stomp_out_name>;
+ stomp_out = stomp(input);
+ tracef("stomp_out: %M\n", stomp_out);
+ string pg_tar_name = @strcat(directory, "/pg.tar");
+ file pg_tar<single_file_mapper;file=pg_tar_name>;
+ string pg_index_name = @strcat(directory, "/pg.index");
+ file pg_index<single_file_mapper;file=pg_index_name>;
+ (pg_tar, pg_index) = pg(stomp_out, directory);
+ tracef("pg output: %M %M\n", pg_tar, pg_index);
+ string pg_entry_names[] = readData(pg_index);
+ file pg_entries[]<array_mapper;files=pg_entry_names>;
+ string sph_transform = @strcat(directory, "/sph-\\1");
+ file sph_outputs[]<structured_regexp_mapper;
+ source=pg_entries,
+ match=".*/pg-(.*)",
+ transform=sph_transform>;
+ foreach pg_entry, i in pg_entries
+ {
+ tracef("sph: %M:%s -> %M\n",
+ pg_tar, pg_entry_names[i], sph_outputs[i]);
+ sph_outputs[i] = sph(pg_tar, pg_entry_names[i]);
+ }
+ output = gpg(sph_outputs);
+ tracef("model output: %M\n", output);
+}
+
+int iterations = @toint(@arg("iters"));
+
+file inputs[];
+file input0<"data-0.txt">;
+tracef("starting with: %M\n", input0);
+inputs[0] = input0;
+
+iterate iter {
+ tracef("iter: %i\n", iter);
+ string output_name = @strcat("data-", iter+1, ".txt");
+ tracef("output_name: %s\n", output_name);
+ file output<single_file_mapper;file=output_name>;
+ output = model(inputs[iter], iter);
+ inputs[iter+1] = output;
+} until (iter > iterations);
Added: trunk/tests/apps/STOMP.txt
===================================================================
--- trunk/tests/apps/STOMP.txt (rev 0)
+++ trunk/tests/apps/STOMP.txt 2011-09-06 14:50:24 UTC (rev 5072)
@@ -0,0 +1,18 @@
+
+ROADMAP
+
+start with data-0.txt
+
+run: "stomp data-0.txt" generates: run-0/ and run-0/stomp.out
+
+run: pg stomp.out generates: tarfile of pg-*.out files
+ (we can apply CDM to avoid data copies here)
+
+on each tarfile entry,
+run: sph tarfile pg-number.out generates: sph-number.out
+ the sph wrapper extracts the entry
+ (we can apply CDM to avoid the full tarfile transfer)
+
+run: gpg sph-*.out generates: data-1.txt
+
+repeat
Added: trunk/tests/apps/gpg.sh
===================================================================
--- trunk/tests/apps/gpg.sh (rev 0)
+++ trunk/tests/apps/gpg.sh 2011-09-06 14:50:24 UTC (rev 5072)
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Simply transforms an input to an output
+
+OUTPUT=$1
+shift
+INPUTS=${*}
+
+mkdir -p $( dirname ${INPUT} )
+for s in ${INPUTS}
+do
+ echo ${s}
+done > ${OUTPUT}
+
Property changes on: trunk/tests/apps/gpg.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/apps/pg.sh
===================================================================
--- trunk/tests/apps/pg.sh (rev 0)
+++ trunk/tests/apps/pg.sh 2011-09-06 14:50:24 UTC (rev 5072)
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Generates multiple PG outputs, bundles them into OUTPUT tarfile
+# INDEX contains names of PG outputs and
+# is compatible with Swift readData()
+
+INPUT=$1
+DIRECTORY=$2
+OUTPUT=$3
+INDEX=$4
+
+set -x
+
+# Operate in directory (run-*)
+mkdir -p ${DIRECTORY}
+pushd ${DIRECTORY}
+
+# Create outputs
+PG_OUTS=$( echo pg-{a,b,c}.out )
+touch ${PG_OUTS[@]}
+TAR=$( basename ${OUTPUT} )
+tar cf ${TAR} ${PG_OUTS[@]}
+
+# Make index
+popd
+for s in ${PG_OUTS[@]}
+do
+ echo ${DIRECTORY}/${s}
+done > ${INDEX}
Property changes on: trunk/tests/apps/pg.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/apps/sph.sh
===================================================================
--- trunk/tests/apps/sph.sh (rev 0)
+++ trunk/tests/apps/sph.sh 2011-09-06 14:50:24 UTC (rev 5072)
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -x
+
+TARFILE=$1
+ENTRY=$2
+OUTPUT=$3
+
+# Entry name contains directory: remove it
+ENTRY=$( basename ${ENTRY} )
+
+tar xf ${TARFILE} ${ENTRY} || exit 1
+touch ${OUTPUT}
+
+exit 0
Property changes on: trunk/tests/apps/sph.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/tests/apps/stomp.sh
===================================================================
--- trunk/tests/apps/stomp.sh (rev 0)
+++ trunk/tests/apps/stomp.sh 2011-09-06 14:50:24 UTC (rev 5072)
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Simply transforms an input to an output
+
+INPUT=$1
+OUTPUT=$2
+
+mkdir -pv $( dirname ${OUTPUT} )
+
+cp ${INPUT} ${OUTPUT}
Property changes on: trunk/tests/apps/stomp.sh
___________________________________________________________________
Added: svn:executable
+ *
More information about the Swift-commit
mailing list