Revision
107494
Author
marius@macports.org
Date
2013-07-01 08:11:13 -0700 (Mon, 01 Jul 2013)

Log Message

Added envvariables test.

Added Paths

Diff

Added: branches/gsoc13-tests/tests/test/envvariables/test.tcl (0 => 107494)


--- branches/gsoc13-tests/tests/test/envvariables/test.tcl	                        (rev 0)
+++ branches/gsoc13-tests/tests/test/envvariables/test.tcl	2013-07-01 15:11:13 UTC (rev 107494)
@@ -0,0 +1,47 @@
+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+set file "output"
+set dir "work"
+set path [file dirname [file normalize $argv0]]
+
+# Initial setup
+load_variables $path
+set_dir
+port_index
+port_clean $path
+
+proc envvar_test {} {
+    global file
+    global path
+
+    # Make helping script
+    set fp [open script.sh w+]
+    puts $fp "export ENVA=A; export ENVB=B; \
+    export PORTSRC=/Volumes/Other/gsoc/macports-all/branches/gsoc13-tests/tests/test-macports.conf; \
+    /opt/macports-test/bin/port test"
+    close $fp
+
+    exec sh script.sh > output
+    set line [get_line $path/$file "a"]
+    set line2 [get_line $path/$file "b"]
+    return $line$line2
+}
+
+test envvariables {
+    Regression test for Environment Variables.
+} -constraints {
+    root
+} -body {
+    envvar_test
+} -result "ab"
+
+
+# remove output file and print results
+removeFile script.sh
+removeFile $file
+removeDirectory $dir
+
+cleanupTests