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: 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. T9579_outofheap_rtsall: Use `+RTS -M<size>' to increase it.
251
T9579_outofheap_rtsall_no_suggestions: Heap exhausted; 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: 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. T9579_outofheap_rtsnone: Relink with -rtsopts and use `+RTS -M<size>' to increase it.
251
T9579_outofheap_rtssome: Heap exhausted; 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. 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. 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. 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. T9579_stackoverflow_rtssome: Relink with -rtsopts and use `+RTS -Ksize -RTS' to increase it.
2
test('T9579_stackoverflow_rtsnone', # some numbers like "(1 MB)" would still remain.
[exit_code(2), # but let's just assume the actual difference in bytes
extra_clean([ 'tmp_T9579_stackoverflow_rtsnone/Main.hi', # is too small to have an effect on the rounded megabyte value.
'tmp_T9579_stackoverflow_rtsnone/Main.o' ])],
run_command, def T9579_run_test(binName, expExitCode):
['$MAKE -s --no-print-directory T9579_stackoverflow_rtsnone \ fmt = lambda s: s.format(binName=binName)
&& ./T9579_stackoverflow_rtsnone']) # 1. compile the binary using MAKE
# 2. redirect stderr to stdout
test('T9579_stackoverflow_rtssome', # 3. capture exitcode using echo
[exit_code(2), # 4. replace actual number with NUM
extra_clean([ 'tmp_T9579_stackoverflow_rtssome/Main.hi', testCommandTemplate = """
'tmp_T9579_stackoverflow_rtssome/Main.o' ])], $MAKE -s --no-print-directory T9579_{binName} \
run_command, && ( ( ./T9579_{binName} 2>&1; echo $?) \
['$MAKE -s --no-print-directory T9579_stackoverflow_rtssome \ | sed -e 's/[0-9]\+ bytes/NUM bytes/g' ) \
&& ./T9579_stackoverflow_rtssome']) """
test('T9579_stackoverflow_rtsall', test(fmt('T9579_{binName}'),
[exit_code(2), [extra_clean([ fmt('tmp_T9579_{binName}/Main.hi'),
extra_clean([ 'tmp_T9579_stackoverflow_rtsall/Main.hi', fmt('tmp_T9579_{binName}/Main.o') ])],
'tmp_T9579_stackoverflow_rtsall/Main.o' ])], run_command,
run_command, [fmt(testCommandTemplate)])
['$MAKE -s --no-print-directory T9579_stackoverflow_rtsall \
&& ./T9579_stackoverflow_rtsall']) T9579_run_test('stackoverflow_rtsnone',2)
T9579_run_test('stackoverflow_rtssome',2)
test('T9579_stackoverflow_rtsall_no_suggestions', T9579_run_test('stackoverflow_rtsall',2)
[exit_code(2), T9579_run_test('stackoverflow_rtsall_no_suggestions',2)
extra_clean([ 'tmp_T9579_stackoverflow_rtsall_no_suggestions/Main.hi',
'tmp_T9579_stackoverflow_rtsall_no_suggestions/Main.o' ])], T9579_run_test('outofheap_rtsnone',251)
run_command, T9579_run_test('outofheap_rtssome',251)
['$MAKE -s --no-print-directory T9579_stackoverflow_rtsall_no_suggestions \ T9579_run_test('outofheap_rtsall',251)
&& ./T9579_stackoverflow_rtsall_no_suggestions']) T9579_run_test('outofheap_rtsall_no_suggestions',251)
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'])
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