Commit 4b8b4ce1 authored by Javran Cheng's avatar Javran Cheng Committed by Erik de Castro Lopo
Browse files

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
parent a171cc13
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
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
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
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
T9579_stackoverflow_rtsall: Stack space overflow: current size 99136 bytes.
T9579_stackoverflow_rtsall: Stack space overflow: current size NUM bytes.
T9579_stackoverflow_rtsall: Use `+RTS -Ksize -RTS' to increase it.
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
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
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
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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment