summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJavran Cheng <Javran.c@gmail.com>2015-05-13 07:54:57 +1000
committerErik de Castro Lopo <erikd@mega-nerd.com>2015-05-13 08:44:56 +1000
commit4b8b4ce12a1b5f682071a27bc313649fa50e0e91 (patch)
tree3599ecfceec8298864d3817088fb6f2de4cf5959 /testsuite
parenta171cc133cc1111e91cf892fdbaa7ca476129b07 (diff)
downloadhaskell-4b8b4ce12a1b5f682071a27bc313649fa50e0e91.tar.gz
Fix fragile T9579 tests
Fix fragile tests according to comment 13 of #9579 (by @bherzog) Done by capturing stderr and replace `xx bytes` with `NUM bytes` (literal). Some numbers like `(1 MB)` would still remain, but I think it's safe to assume the actual difference in bytes (on different architectures) is too small to have an effect on the rounded megabyte value. Test Plan: validate Reviewers: erikd, austin Reviewed By: erikd, austin Subscribers: erikd, bgamari, thomie, bherzog Differential Revision: https://phabricator.haskell.org/D882 GHC Trac Issues: #9579
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/rts/T9579/T9579_outofheap_rtsall.stdout (renamed from testsuite/tests/rts/T9579/T9579_outofheap_rtsall.stderr)3
-rw-r--r--testsuite/tests/rts/T9579/T9579_outofheap_rtsall_no_suggestions.stdout (renamed from testsuite/tests/rts/T9579/T9579_outofheap_rtsall_no_suggestions.stderr)3
-rw-r--r--testsuite/tests/rts/T9579/T9579_outofheap_rtsnone.stdout (renamed from testsuite/tests/rts/T9579/T9579_outofheap_rtsnone.stderr)3
-rw-r--r--testsuite/tests/rts/T9579/T9579_outofheap_rtssome.stdout (renamed from testsuite/tests/rts/T9579/T9579_outofheap_rtssome.stderr)3
-rw-r--r--testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall.stderr2
-rw-r--r--testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall.stdout3
-rw-r--r--testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall_no_suggestions.stdout (renamed from testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall_no_suggestions.stderr)3
-rw-r--r--testsuite/tests/rts/T9579/T9579_stackoverflow_rtsnone.stdout (renamed from testsuite/tests/rts/T9579/T9579_stackoverflow_rtsnone.stderr)3
-rw-r--r--testsuite/tests/rts/T9579/T9579_stackoverflow_rtssome.stdout (renamed from testsuite/tests/rts/T9579/T9579_stackoverflow_rtssome.stderr)3
-rw-r--r--testsuite/tests/rts/T9579/all.T95
10 files changed, 48 insertions, 73 deletions
diff --git a/testsuite/tests/rts/T9579/T9579_outofheap_rtsall.stderr b/testsuite/tests/rts/T9579/T9579_outofheap_rtsall.stdout
index 3d7cfe7565..0612a88630 100644
--- a/testsuite/tests/rts/T9579/T9579_outofheap_rtsall.stderr
+++ b/testsuite/tests/rts/T9579/T9579_outofheap_rtsall.stdout
@@ -1,3 +1,4 @@
T9579_outofheap_rtsall: Heap exhausted;
-T9579_outofheap_rtsall: Current maximum heap size is 1048576 bytes (1 MB).
+T9579_outofheap_rtsall: Current maximum heap size is NUM bytes (1 MB).
T9579_outofheap_rtsall: Use `+RTS -M<size>' to increase it.
+251
diff --git a/testsuite/tests/rts/T9579/T9579_outofheap_rtsall_no_suggestions.stderr b/testsuite/tests/rts/T9579/T9579_outofheap_rtsall_no_suggestions.stdout
index c5d1ce3878..9f03a370d9 100644
--- a/testsuite/tests/rts/T9579/T9579_outofheap_rtsall_no_suggestions.stderr
+++ b/testsuite/tests/rts/T9579/T9579_outofheap_rtsall_no_suggestions.stdout
@@ -1,2 +1,3 @@
T9579_outofheap_rtsall_no_suggestions: Heap exhausted;
-T9579_outofheap_rtsall_no_suggestions: Current maximum heap size is 1048576 bytes (1 MB).
+T9579_outofheap_rtsall_no_suggestions: Current maximum heap size is NUM bytes (1 MB).
+251
diff --git a/testsuite/tests/rts/T9579/T9579_outofheap_rtsnone.stderr b/testsuite/tests/rts/T9579/T9579_outofheap_rtsnone.stdout
index 3bc209688e..38b57a078c 100644
--- a/testsuite/tests/rts/T9579/T9579_outofheap_rtsnone.stderr
+++ b/testsuite/tests/rts/T9579/T9579_outofheap_rtsnone.stdout
@@ -1,3 +1,4 @@
T9579_outofheap_rtsnone: Heap exhausted;
-T9579_outofheap_rtsnone: Current maximum heap size is 1048576 bytes (1 MB).
+T9579_outofheap_rtsnone: Current maximum heap size is NUM bytes (1 MB).
T9579_outofheap_rtsnone: Relink with -rtsopts and use `+RTS -M<size>' to increase it.
+251
diff --git a/testsuite/tests/rts/T9579/T9579_outofheap_rtssome.stderr b/testsuite/tests/rts/T9579/T9579_outofheap_rtssome.stdout
index a6f03776db..29400b8c45 100644
--- a/testsuite/tests/rts/T9579/T9579_outofheap_rtssome.stderr
+++ b/testsuite/tests/rts/T9579/T9579_outofheap_rtssome.stdout
@@ -1,3 +1,4 @@
T9579_outofheap_rtssome: Heap exhausted;
-T9579_outofheap_rtssome: Current maximum heap size is 1048576 bytes (1 MB).
+T9579_outofheap_rtssome: Current maximum heap size is NUM bytes (1 MB).
T9579_outofheap_rtssome: Relink with -rtsopts and use `+RTS -M<size>' to increase it.
+251
diff --git a/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall.stderr b/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall.stderr
deleted file mode 100644
index 16404b8b87..0000000000
--- a/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall.stderr
+++ /dev/null
@@ -1,2 +0,0 @@
-T9579_stackoverflow_rtsall: Stack space overflow: current size 99136 bytes.
-T9579_stackoverflow_rtsall: Use `+RTS -Ksize -RTS' to increase it.
diff --git a/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall.stdout b/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall.stdout
new file mode 100644
index 0000000000..6d128893fa
--- /dev/null
+++ b/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall.stdout
@@ -0,0 +1,3 @@
+T9579_stackoverflow_rtsall: Stack space overflow: current size NUM bytes.
+T9579_stackoverflow_rtsall: Use `+RTS -Ksize -RTS' to increase it.
+2
diff --git a/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall_no_suggestions.stderr b/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall_no_suggestions.stdout
index 29a04b5159..36390cdde3 100644
--- a/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall_no_suggestions.stderr
+++ b/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsall_no_suggestions.stdout
@@ -1 +1,2 @@
-T9579_stackoverflow_rtsall_no_suggestions: Stack space overflow: current size 99136 bytes.
+T9579_stackoverflow_rtsall_no_suggestions: Stack space overflow: current size NUM bytes.
+2
diff --git a/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsnone.stderr b/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsnone.stdout
index 9151addaf2..a5121d7092 100644
--- a/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsnone.stderr
+++ b/testsuite/tests/rts/T9579/T9579_stackoverflow_rtsnone.stdout
@@ -1,2 +1,3 @@
-T9579_stackoverflow_rtsnone: Stack space overflow: current size 99136 bytes.
+T9579_stackoverflow_rtsnone: Stack space overflow: current size NUM bytes.
T9579_stackoverflow_rtsnone: Relink with -rtsopts and use `+RTS -Ksize -RTS' to increase it.
+2
diff --git a/testsuite/tests/rts/T9579/T9579_stackoverflow_rtssome.stderr b/testsuite/tests/rts/T9579/T9579_stackoverflow_rtssome.stdout
index 3bbfefe1b7..62582a749a 100644
--- a/testsuite/tests/rts/T9579/T9579_stackoverflow_rtssome.stderr
+++ b/testsuite/tests/rts/T9579/T9579_stackoverflow_rtssome.stdout
@@ -1,2 +1,3 @@
-T9579_stackoverflow_rtssome: Stack space overflow: current size 99136 bytes.
+T9579_stackoverflow_rtssome: Stack space overflow: current size NUM bytes.
T9579_stackoverflow_rtssome: Relink with -rtsopts and use `+RTS -Ksize -RTS' to increase it.
+2
diff --git a/testsuite/tests/rts/T9579/all.T b/testsuite/tests/rts/T9579/all.T
index e029b4acb0..fd5a3b64a7 100644
--- a/testsuite/tests/rts/T9579/all.T
+++ b/testsuite/tests/rts/T9579/all.T
@@ -1,64 +1,31 @@
-test('T9579_stackoverflow_rtsnone',
- [exit_code(2),
- extra_clean([ 'tmp_T9579_stackoverflow_rtsnone/Main.hi',
- 'tmp_T9579_stackoverflow_rtsnone/Main.o' ])],
- run_command,
- ['$MAKE -s --no-print-directory T9579_stackoverflow_rtsnone \
- && ./T9579_stackoverflow_rtsnone'])
-
-test('T9579_stackoverflow_rtssome',
- [exit_code(2),
- extra_clean([ 'tmp_T9579_stackoverflow_rtssome/Main.hi',
- 'tmp_T9579_stackoverflow_rtssome/Main.o' ])],
- run_command,
- ['$MAKE -s --no-print-directory T9579_stackoverflow_rtssome \
- && ./T9579_stackoverflow_rtssome'])
-
-test('T9579_stackoverflow_rtsall',
- [exit_code(2),
- extra_clean([ 'tmp_T9579_stackoverflow_rtsall/Main.hi',
- 'tmp_T9579_stackoverflow_rtsall/Main.o' ])],
- run_command,
- ['$MAKE -s --no-print-directory T9579_stackoverflow_rtsall \
- && ./T9579_stackoverflow_rtsall'])
-
-test('T9579_stackoverflow_rtsall_no_suggestions',
- [exit_code(2),
- extra_clean([ 'tmp_T9579_stackoverflow_rtsall_no_suggestions/Main.hi',
- 'tmp_T9579_stackoverflow_rtsall_no_suggestions/Main.o' ])],
- run_command,
- ['$MAKE -s --no-print-directory T9579_stackoverflow_rtsall_no_suggestions \
- && ./T9579_stackoverflow_rtsall_no_suggestions'])
-
-test('T9579_outofheap_rtsnone',
- [exit_code(251),
- extra_clean([ 'tmp_T9579_outofheap_rtsnone/Main.hi',
- 'tmp_T9579_outofheap_rtsnone/Main.o' ])],
- run_command,
- ['$MAKE -s --no-print-directory T9579_outofheap_rtsnone \
- && ./T9579_outofheap_rtsnone'])
-
-test('T9579_outofheap_rtssome',
- [exit_code(251),
- extra_clean([ 'tmp_T9579_outofheap_rtssome/Main.hi',
- 'tmp_T9579_outofheap_rtssome/Main.o' ])],
- run_command,
- ['$MAKE -s --no-print-directory T9579_outofheap_rtssome \
- && ./T9579_outofheap_rtssome'])
-
-test('T9579_outofheap_rtsall',
- [exit_code(251),
- extra_clean([ 'tmp_T9579_outofheap_rtsall/Main.hi',
- 'tmp_T9579_outofheap_rtsall/Main.o' ])],
-
- run_command,
- ['$MAKE -s --no-print-directory T9579_outofheap_rtsall \
- && ./T9579_outofheap_rtsall'])
-
-test('T9579_outofheap_rtsall_no_suggestions',
- [exit_code(251),
- extra_clean([ 'tmp_T9579_outofheap_rtsall_no_suggestions/Main.hi',
- 'tmp_T9579_outofheap_rtsall_no_suggestions/Main.o' ])],
- run_command,
- ['$MAKE -s --no-print-directory T9579_outofheap_rtsall_no_suggestions \
- && ./T9579_outofheap_rtsall_no_suggestions'])
+# some numbers like "(1 MB)" would still remain.
+# but let's just assume the actual difference in bytes
+# is too small to have an effect on the rounded megabyte value.
+
+def T9579_run_test(binName, expExitCode):
+ fmt = lambda s: s.format(binName=binName)
+ # 1. compile the binary using MAKE
+ # 2. redirect stderr to stdout
+ # 3. capture exitcode using echo
+ # 4. replace actual number with NUM
+ testCommandTemplate = """
+ $MAKE -s --no-print-directory T9579_{binName} \
+ && ( ( ./T9579_{binName} 2>&1; echo $?) \
+ | sed -e 's/[0-9]\+ bytes/NUM bytes/g' ) \
+ """
+
+ test(fmt('T9579_{binName}'),
+ [extra_clean([ fmt('tmp_T9579_{binName}/Main.hi'),
+ fmt('tmp_T9579_{binName}/Main.o') ])],
+ run_command,
+ [fmt(testCommandTemplate)])
+
+T9579_run_test('stackoverflow_rtsnone',2)
+T9579_run_test('stackoverflow_rtssome',2)
+T9579_run_test('stackoverflow_rtsall',2)
+T9579_run_test('stackoverflow_rtsall_no_suggestions',2)
+
+T9579_run_test('outofheap_rtsnone',251)
+T9579_run_test('outofheap_rtssome',251)
+T9579_run_test('outofheap_rtsall',251)
+T9579_run_test('outofheap_rtsall_no_suggestions',251)