Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in / Register
Toggle navigation
N
nofib
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Glasgow Haskell Compiler
nofib
Commits
637337f8
Commit
637337f8
authored
May 18, 2019
by
Ben Gamari
🐢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor flags
parent
6d9f33ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
Main.hs
shake/Main.hs
+10
-6
No files found.
shake/Main.hs
View file @
637337f8
...
...
@@ -69,7 +69,9 @@ data Nofib
,
compiler_args
::
String
,
tag
::
String
,
output
::
String
,
run
::
Maybe
Speed
,
cachegrind
::
Bool
,
run
::
Bool
,
speed
::
Speed
,
rts
::
[
String
]
,
times
::
Int
,
skip_check
::
Bool
...
...
@@ -93,7 +95,9 @@ nofibMode = cmdArgsMode $ modes
,
compiler_args
=
""
&=
help
"Extra arguments to pass to the Compiler when building tests"
,
tag
=
""
&=
help
"Tag to name the compiler, defaults to compiler --version"
,
output
=
""
&=
help
"Where to put created files under _make, defaults to tag/way"
,
run
=
Nothing
&=
groupname
"Running"
&=
opt
"norm"
&=
help
"Run the results (Fast,Norm,Slow)"
,
cachegrind
=
False
&=
groupname
"Running"
&=
help
"Run the tests under cachegrind (Fast,Norm,Slow)"
,
run
=
False
&=
groupname
"Running"
&=
help
"Run the tests"
,
speed
=
Norm
&=
groupname
"Running"
&=
help
"Test speed (Fast,Norm,Slow)"
,
times
=
1
&=
help
"Number of times to run each test"
,
rts
=
[]
&=
help
"Which RTS options to pass when running"
,
skip_check
=
False
&=
help
"Skip checking the results of the tests"
...
...
@@ -161,7 +165,7 @@ main = do
buildRules
args
putStrLn
"Build completed"
when
(
isJust
run
)
$
do
when
run
$
do
ns
<-
mapM
(
runTest
args
)
tests
let
tot
=
length
ns
bad
=
length
$
filter
not
ns
...
...
@@ -197,7 +201,7 @@ buildRules nofib@Build{..} = do
in
f
$
takeDirectory
$
drop
(
length
output
+
1
)
x
want
$
concat
[
[
s
</>
"Main"
<.>
exe
,
s
</>
"config.txt"
]
|
t
<-
tests
,
let
s
=
output
</>
t
]
w
ant
$
[
"cachegrind"
]
w
hen
cachegrind
$
want
[
"cachegrind"
]
"//all-results"
%>
\
out
->
do
let
results
=
[
s
</>
"Main"
<.>
exe
<.>
"result"
...
...
@@ -295,7 +299,7 @@ buildRules nofib@Build{..} = do
cmd_
(
Cwd
test
)
(
EchoStdout
False
)
(
StdinBS
stdin
)
"valgrind"
"--tool=cachegrind"
(
"--cachegrind-out-file="
++
out'
)
executable
args
getTestCmdline
::
Nofib
->
String
->
IO
(
BSL
.
ByteString
,
[
String
])
getTestCmdline
nofib
@
Build
{
run
=
Just
speed
,
..
}
test
=
do
getTestCmdline
nofib
@
Build
{
..
}
test
=
do
config
<-
readConfig
$
output
</>
test
</>
"config.txt"
let
args
=
words
(
config
"PROG_ARGS"
)
++
words
(
config
$
map
toUpper
(
show
speed
)
++
"_OPTS"
)
stdin
<-
let
s
=
config
"STDIN_FILE"
in
if
s
==
""
then
grab
"stdin"
else
BSL
.
readFile
$
test
</>
s
...
...
@@ -311,7 +315,7 @@ getTestCmdline nofib@Build{run=Just speed,..} test = do
-- | Run a test, checking stdout/stderr are as expected, and reporting time.
-- Return True if the test passes.
runTest
::
Nofib
->
String
->
IO
Bool
runTest
nofib
@
Build
{
run
=
Just
speed
,
..
}
test
=
do
runTest
nofib
@
Build
{
..
}
test
=
do
putStrLn
$
"==nofib== "
++
takeDirectory1
test
++
": time to run "
++
takeDirectory1
test
++
" follows..."
(
stdin
,
args
)
<-
getTestCmdline
nofib
test
stats
<-
IO
.
canonicalizePath
$
output
</>
test
</>
"stat.txt"
...
...
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