summaryrefslogtreecommitdiff
path: root/testsuite/lib.test/fileutils.exp
diff options
context:
space:
mode:
authorSami Kerola <kerolasa@iki.fi>2012-03-23 11:10:04 +0100
committerSami Kerola <kerolasa@iki.fi>2012-03-23 15:57:41 +0100
commitc7cf98b0e03780f78abe5275c6fb282f71a2369f (patch)
tree922269cec4c0e6edb667a49de0e5f659faa6276e /testsuite/lib.test/fileutils.exp
parent1462c4e581caf22b2e7fe155691dfcddcb51b3f7 (diff)
downloadprocps-ng-c7cf98b0e03780f78abe5275c6fb282f71a2369f.tar.gz
lib: add fileutils file with stream error checking facility
The close_stream() is copied from GNU lib. Inspiration to do this is talk by Jim Meyering - Goodbye World! The perils of relying on output streams in C. Reference: http://www.irill.org/events/ghm-gnu-hackers-meeting/videos/jim-meyering-goodbye-world-the-perils-of-relying-on-output-streams-in-c Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'testsuite/lib.test/fileutils.exp')
-rw-r--r--testsuite/lib.test/fileutils.exp19
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/lib.test/fileutils.exp b/testsuite/lib.test/fileutils.exp
new file mode 100644
index 0000000..3fab11e
--- /dev/null
+++ b/testsuite/lib.test/fileutils.exp
@@ -0,0 +1,19 @@
+#
+# Testsuite for lib/fileutils program
+#
+
+set noarg "${topdir}lib/test_fileutils"
+
+set test "without argument"
+spawn $noarg
+expect_pass "$test" "Hello, World!"
+
+set badfd "${topdir}testsuite/lib.test/fileutils_badfd.sh"
+set test "test bad file descriptor"
+spawn $badfd
+expect_pass "$test" "test_fileutils: write error: Bad file descriptor"
+
+set full "${topdir}testsuite/lib.test/fileutils_full.sh"
+set test "test no space left on device"
+spawn $full
+expect_pass "$test" "test_fileutils: write error: No space left on device"