Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
a1b1ca7a
Commit
a1b1ca7a
authored
11 years ago
by
Daniel Dunbar
Browse files
Options
Downloads
Patches
Plain Diff
[lit] Factor out Run class to capture configuration + discovered tests.
llvm-svn: 189550
parent
d73eaabc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
llvm/utils/lit/lit/main.py
+21
-18
21 additions, 18 deletions
llvm/utils/lit/lit/main.py
llvm/utils/lit/lit/run.py
+8
-0
8 additions, 0 deletions
llvm/utils/lit/lit/run.py
with
29 additions
and
18 deletions
llvm/utils/lit/lit/main.py
+
21
−
18
View file @
a1b1ca7a
...
...
@@ -12,6 +12,7 @@ import math, os, platform, random, re, sys, time, threading, traceback
import
lit.ProgressBar
import
lit.LitConfig
import
lit.Test
import
lit.run
import
lit.util
import
lit.discovery
...
...
@@ -291,12 +292,14 @@ def main(builtinParameters = {}):
params
=
userParams
,
config_prefix
=
opts
.
configPrefix
)
tests
=
lit
.
discovery
.
find_tests_for_inputs
(
litConfig
,
inputs
)
# Perform test discovery.
run
=
lit
.
run
.
Run
(
litConfig
,
lit
.
discovery
.
find_tests_for_inputs
(
litConfig
,
inputs
))
if
opts
.
showSuites
or
opts
.
showTests
:
# Aggregate the tests by suite.
suitesAndTests
=
{}
for
t
in
tests
:
for
t
in
run
.
tests
:
if
t
.
suite
not
in
suitesAndTests
:
suitesAndTests
[
t
.
suite
]
=
[]
suitesAndTests
[
t
.
suite
].
append
(
t
)
...
...
@@ -323,7 +326,7 @@ def main(builtinParameters = {}):
sys
.
exit
(
0
)
# Select and order the tests.
numTotalTests
=
len
(
tests
)
numTotalTests
=
len
(
run
.
tests
)
# First, select based on the filter expression if given.
if
opts
.
filter
:
...
...
@@ -332,26 +335,26 @@ def main(builtinParameters = {}):
except
:
parser
.
error
(
"
invalid regular expression for --filter: %r
"
%
(
opts
.
filter
))
tests
=
[
t
for
t
in
tests
if
rex
.
search
(
t
.
getFullName
())]
run
.
tests
=
[
t
for
t
in
run
.
tests
if
rex
.
search
(
t
.
getFullName
())]
# Then select the order.
if
opts
.
shuffle
:
random
.
shuffle
(
tests
)
random
.
shuffle
(
run
.
tests
)
else
:
tests
.
sort
(
key
=
lambda
t
:
t
.
getFullName
())
run
.
tests
.
sort
(
key
=
lambda
t
:
t
.
getFullName
())
# Finally limit the number of tests, if desired.
if
opts
.
maxTests
is
not
None
:
tests
=
tests
[:
opts
.
maxTests
]
run
.
tests
=
run
.
tests
[:
opts
.
maxTests
]
# Don't create more threads than tests.
opts
.
numThreads
=
min
(
len
(
tests
),
opts
.
numThreads
)
opts
.
numThreads
=
min
(
len
(
run
.
tests
),
opts
.
numThreads
)
extra
=
''
if
len
(
tests
)
!=
numTotalTests
:
if
len
(
run
.
tests
)
!=
numTotalTests
:
extra
=
'
of %d
'
%
numTotalTests
header
=
'
-- Testing: %d%s tests, %d threads --
'
%
(
len
(
tests
),
extra
,
header
=
'
-- Testing: %d%s tests, %d threads --
'
%
(
len
(
run
.
tests
),
extra
,
opts
.
numThreads
)
progressBar
=
None
...
...
@@ -367,8 +370,8 @@ def main(builtinParameters = {}):
print
(
header
)
startTime
=
time
.
time
()
display
=
TestingProgressDisplay
(
opts
,
len
(
tests
),
progressBar
)
provider
=
TestProvider
(
tests
,
opts
.
maxTime
)
display
=
TestingProgressDisplay
(
opts
,
len
(
run
.
tests
),
progressBar
)
provider
=
TestProvider
(
run
.
tests
,
opts
.
maxTime
)
try
:
import
win32api
...
...
@@ -387,14 +390,14 @@ def main(builtinParameters = {}):
print
(
'
Testing Time: %.2fs
'
%
(
time
.
time
()
-
startTime
))
# Update results for any tests which weren't run.
for
test
in
tests
:
for
test
in
run
.
tests
:
if
test
.
result
is
None
:
test
.
setResult
(
lit
.
Test
.
Result
(
lit
.
Test
.
UNRESOLVED
,
''
,
0.0
))
# List test results organized by kind.
hasFailures
=
False
byCode
=
{}
for
test
in
tests
:
for
test
in
run
.
tests
:
if
test
.
result
.
code
not
in
byCode
:
byCode
[
test
.
result
.
code
]
=
[]
byCode
[
test
.
result
.
code
].
append
(
test
)
...
...
@@ -414,12 +417,12 @@ def main(builtinParameters = {}):
print
(
'
%s
'
%
test
.
getFullName
())
sys
.
stdout
.
write
(
'
\n
'
)
if
opts
.
timeTests
and
tests
:
if
opts
.
timeTests
and
run
.
tests
:
# Order by time.
test_times
=
[(
test
.
getFullName
(),
test
.
result
.
elapsed
)
for
test
in
tests
]
for
test
in
run
.
tests
]
lit
.
util
.
printHistogram
(
test_times
,
title
=
'
Tests
'
)
for
name
,
code
in
((
'
Expected Passes
'
,
lit
.
Test
.
PASS
),
(
'
Expected Failures
'
,
lit
.
Test
.
XFAIL
),
(
'
Unsupported Tests
'
,
lit
.
Test
.
UNSUPPORTED
),
...
...
This diff is collapsed.
Click to expand it.
llvm/utils/lit/lit/run.py
0 → 100644
+
8
−
0
View file @
a1b1ca7a
class
Run
(
object
):
"""
This class represents a concrete, configured testing run.
"""
def
__init__
(
self
,
lit_config
,
tests
):
self
.
lit_config
=
lit_config
self
.
tests
=
tests
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment