Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
3e9fa923
Commit
3e9fa923
authored
Sep 18, 2006
by
ravi@bluespec.com
Browse files
add tests for heap profiles and hp2ps
parent
31836e4b
Changes
5
Hide whitespace changes
Inline
Side-by-side
testsuite/config/bad.ps
0 → 100644
View file @
3e9fa923
This
is
a
bad
postscript
file
testsuite/config/ghc
View file @
3e9fa923
...
...
@@ -6,6 +6,10 @@ config.compiler_type = 'ghc'
config.compiler = 'ghc'
config.compiler_always_flags = ['-no-recomp', '-dcore-lint', '-dcmm-lint']
config.hp2ps = 'hp2ps'
config.gs = 'gs'
config.confdir = '.'
# By default, we test the 'normal', 'opt' and 'hpc' ways.
# 'optasm' is added by mk/test.mk if the compiler has a native code gen,
# 'prof' is added by mk/test.mk if the profiling way is enabled.
...
...
testsuite/config/good.ps
0 → 100644
View file @
3e9fa923
% this is a good postscript file
testsuite/driver/testlib.py
View file @
3e9fa923
...
...
@@ -297,7 +297,7 @@ def test_common_work (name, opts, func, args):
'.comp.stderr'
,
'.comp.stdout'
,
'.interp.stderr'
,
'.interp.stdout'
,
'.hi'
,
'.o'
,
'.prof'
,
'.exe.prof'
,
'.hc'
,
'_stub.h'
,
'_stub.c'
,
'_stub.o'
,
'.hp'
,
'.exe.hp'
]))
'_stub.o'
,
'.hp'
,
'.exe.hp'
,
'.ps'
,
'.aux'
,
'.hcr'
]))
def
clean
(
names
):
clean_full_paths
(
map
(
lambda
name
:
in_testdir
(
name
),
names
))
...
...
@@ -584,10 +584,14 @@ def simple_run( name, way, prog, args, ignore_output_files ):
rm_no_fail
(
qualify
(
name
,
'run.stdout'
))
rm_no_fail
(
qualify
(
name
,
'run.stderr'
))
rm_no_fail
(
qualify
(
name
,
'hp'
))
rm_no_fail
(
qualify
(
name
,
'ps'
))
my_rts_flags
=
rts_flags
(
way
)
cmd
=
'cd '
+
testdir
+
' && '
\
+
prog
+
' '
+
args
+
' '
\
+
rts_flags
(
way
)
+
' '
\
+
my_
rts_flags
+
' '
\
+
' <'
+
use_stdin
\
+
' >'
+
run_stdout
\
+
' 2>'
+
run_stderr
...
...
@@ -603,7 +607,11 @@ def simple_run( name, way, prog, args, ignore_output_files ):
print
'Wrong exit code (expected'
,
getTestOpts
().
exit_code
,
', actual'
,
exit_code
,
')'
return
'fail'
if
ignore_output_files
or
(
check_stdout_ok
(
name
)
and
check_stderr_ok
(
name
)):
check_hp
=
my_rts_flags
.
find
(
"-h"
)
!=
-
1
if
ignore_output_files
or
(
check_stdout_ok
(
name
)
and
check_stderr_ok
(
name
)
and
(
not
check_hp
or
check_hp_ok
(
name
))):
return
'pass'
else
:
return
'fail'
...
...
@@ -859,6 +867,31 @@ def check_stderr_ok( name ):
return
1
def
check_hp_ok
(
name
):
# do not qualify for hp2ps because we should be in the right directory
hp2psCmd
=
'cd '
+
testdir
+
' && '
+
config
.
hp2ps
+
' '
+
name
hp2psResult
=
runCmdExitCode
(
hp2psCmd
)
actual_ps_file
=
qualify
(
name
,
'ps'
)
if
(
hp2psResult
==
0
):
if
(
os
.
path
.
exists
(
actual_ps_file
)):
if
gs_working
:
gsResult
=
runCmdExitCode
(
genGSCmd
(
actual_ps_file
))
if
(
gsResult
==
0
):
return
(
True
)
else
:
print
"hp2ps output for "
+
name
+
"is not valid PostScript"
else
:
return
(
True
)
# assume postscript is valid without ghostscript
else
:
print
"hp2ps did not generate PostScript for"
+
name
return
(
False
)
else
:
print
"hp2ps error when processing heap profile for "
+
name
return
(
False
)
def
different_outputs
(
str1
,
str2
):
# On Windows, remove '\r' characters from the output
return
re
.
sub
(
'
\r
'
,
''
,
str1
)
!=
re
.
sub
(
'
\r
'
,
''
,
str2
)
...
...
@@ -941,6 +974,36 @@ def runCmd( cmd ):
r
=
os
.
system
(
cmd
)
return
r
<<
8
def
runCmdExitCode
(
cmd
):
return
(
runCmd
(
cmd
)
>>
8
);
# -----------------------------------------------------------------------------
# checking if ghostscript is available for checking the output of hp2ps
def
genGSCmd
(
psfile
):
return
(
config
.
gs
+
' -dNODISPLAY -dBATCH -dQUIET -dNOPAUSE '
+
psfile
);
def
gsNotWorking
():
global
gs_working
print
"GhostScript not available for hp2ps tests"
gs_working
=
0
;
global
gs_working
if
config
.
gs
!=
''
:
resultGood
=
runCmdExitCode
(
genGSCmd
(
config
.
confdir
+
'/good.ps'
));
if
resultGood
==
0
:
resultBad
=
runCmdExitCode
(
genGSCmd
(
config
.
confdir
+
'/bad.ps'
));
if
resultBad
!=
0
:
print
"GhostScript available for hp2ps tests"
gs_working
=
1
;
else
:
gsNotWorking
();
else
:
gsNotWorking
();
else
:
gsNotWorking
();
def
rm_no_fail
(
file
):
try
:
os
.
remove
(
file
)
...
...
testsuite/mk/test.mk
View file @
3e9fa923
...
...
@@ -33,10 +33,13 @@ export MAKE
GHC_STAGE1_ABS
=
$(GHC_COMPILER_DIR_ABS)
/stage1/ghc-inplace
GHC_STAGE2_ABS
=
$(GHC_COMPILER_DIR_ABS)
/stage2/ghc-inplace
GHC_STAGE3_ABS
=
$(GHC_COMPILER_DIR_ABS)
/stage3/ghc-inplace
HP2PS_ABS
=
$(GHC_HP2PS_DIR_ABS)
/hp2ps
GS
=
gs
RUNTESTS
=
$(TOP)
/driver/runtests.py
COMPILER
=
ghc
CONFIG
=
$(TOP)
/config/
$(COMPILER)
CONFIGDIR
=
$(TOP)
/config
CONFIG
=
$(CONFIGDIR)
/
$(COMPILER)
# can be overriden from the command line
ifneq
"$(stage)" ""
...
...
@@ -91,9 +94,12 @@ endif
RUNTEST_OPTS
+=
\
--config
=
$(CONFIG)
\
-e
config.confdir
=
\"
$(CONFIGDIR)
\"
\
-e
config.compiler
=
\"
$(TEST_HC)
\"
\
-e
config.compiler_always_flags.append
"(
\"
-D
$(HostPlatform_CPP)
\"
)"
\
-e
config.compiler_always_flags.append
"(
\"
$(EXTRA_HC_OPTS)
\"
)"
\
-e
config.hp2ps
=
\"
$(HP2PS_ABS)
\"
\
-e
config.gs
=
\"
$(GS)
\"
\
-e
config.platform
=
\"
$(TARGETPLATFORM)
\"
\
-e
config.wordsize
=
\"
$(WORDSIZE)
\"
\
-e
default_testopts.cleanup
=
\"
$(CLEANUP)
\"
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment