Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
finesse
pykat
Commits
b9ae392a
Commit
b9ae392a
authored
Aug 09, 2013
by
Daniel Brown
Browse files
fixes to the commit checker runs every 5 mins
parent
3e59435d
Changes
1
Hide whitespace changes
Inline
Side-by-side
pykat/testing/web/web_interface.py
View file @
b9ae392a
...
...
@@ -28,7 +28,7 @@ scheduled_tests = []
schedule_lock
=
Lock
()
watcher
=
None
enabled_suites
=
[
"physics"
,
"random"
]
commit_check_seconds
=
6
0
commit_check_seconds
=
30
0
print
"Starting up database"
...
...
@@ -61,7 +61,7 @@ else:
SRC_PATH
=
os
.
path
.
join
(
app
.
instance_path
,
"finesse_src"
)
# get HEAD commit to set as starting point for commit checker
prev_commits
=
10
prev_commits
=
2
utils
.
git
([
"checkout"
,
"develop"
],
cwd
=
SRC_PATH
)
latest_data
=
utils
.
git
([
"log"
,
"-"
+
str
(
prev_commits
),
'--pretty=format:"%H"'
],
cwd
=
SRC_PATH
)
latest_commit_id_tested
=
latest_data
[
0
].
split
(
"
\n
"
)[
prev_commits
-
1
].
replace
(
'"'
,
""
).
replace
(
"
\\
"
,
""
)
...
...
@@ -134,7 +134,7 @@ class FinesseProcessWatcher(Thread):
if
os
.
path
.
exists
(
KAT_STORE_EXE
):
os
.
remove
(
KAT_STORE_EXE
)
shutil
.
copyfile
(
KAT_EXE
,
KAT_STORE_EXE
)
shutil
.
copyfile
(
KAT_EXE
,
KAT_STORE_EXE
)
testdoc
=
db
.
get
(
'testid'
,
self
.
process_to_watch
.
test_id
,
...
...
@@ -407,7 +407,7 @@ def __finesse_start_test(git_commit, kats, nobuild=False):
finally
:
schedule_lock
.
release
()
return
jsonify
(
dict
(
state
=
'OK'
)
)
return
dict
(
state
=
'OK'
)
@
app
.
route
(
'/finesse/get_tests'
,
methods
=
[
"POST"
])
def
finesse_get_tests
():
...
...
@@ -779,56 +779,58 @@ def setInterval(interval):
@
setInterval
(
commit_check_seconds
)
def
checkLatestCommits
():
SRC_PATH
=
os
.
path
.
join
(
app
.
instance_path
,
"finesse_src"
)
utils
.
git
([
"checkout"
,
"develop"
],
cwd
=
SRC_PATH
)
utils
.
git
([
"pull"
],
cwd
=
SRC_PATH
)
try
:
SRC_PATH
=
os
.
path
.
join
(
app
.
instance_path
,
"finesse_src"
)
global
latest_commit_id_tested
utils
.
git
([
"checkout"
,
"develop"
],
cwd
=
SRC_PATH
)
utils
.
git
([
"pull"
],
cwd
=
SRC_PATH
)
global
latest_commit_id_tested
out
=
utils
.
git
([
"log"
,
re
.
sub
(
r
"[\W]"
,
''
,
latest_commit_id_tested
)
+
"..HEAD"
,
'--pretty=format:"%H"'
],
cwd
=
SRC_PATH
)
commits_not_tested
=
[]
out
=
utils
.
git
([
"log"
,
re
.
sub
(
r
"[\W]"
,
''
,
latest_commit_id_tested
)
+
"..HEAD"
,
'--pretty=format:"%H"'
],
cwd
=
SRC_PATH
)
commits_not_tested
=
[]
try
:
done_all
=
True
commits
=
[
re
.
sub
(
r
"[\W]"
,
""
,
t
)
for
t
in
out
[
0
].
split
(
"
\n
"
)
]
commits
=
[]
for
c
in
[
re
.
sub
(
r
"[\W]"
,
""
,
t
)
for
t
in
out
[
0
].
split
(
"
\n
"
)]:
if
len
(
str
(
c
))
==
40
:
commits
.
append
(
str
(
c
))
for
commit
in
commits
:
commit
.
strip
()
if
len
(
commit
)
==
40
:
try
:
db
.
get
(
"srccommit"
,
commit
)
print
"Commit already done: "
+
commit
except
RecordNotFound
:
print
"Commit isn't done: "
+
commit
done_all
=
False
commits_not_tested
.
insert
(
0
,
commit
)
if
done_all
:
if
done_all
and
len
(
commits_not_tested
)
==
0
and
len
(
commits
)
>
0
:
latest_commit_id_tested
=
commits
[
0
]
else
:
for
commit
in
commits_not_tested
:
print
"Trying to test "
+
commit
kats
=
dict
()
# only run random and physics suites
global
enabled_suites
elif
len
(
commits_not_tested
)
>
0
:
kats
=
dict
()
# only run random and physics suites
global
enabled_suites
for
suite
in
enabled_suites
:
suite_path
=
os
.
path
.
join
(
app
.
instance_path
,
"finesse_test"
,
"kat_test"
,
suite
)
for
suite
in
enabled_suite
s
:
suite_path
=
os
.
path
.
join
(
app
.
instance_path
,
"finesse_test"
,
"kat_test"
,
suite
)
if
not
suite
in
kat
s
:
kats
[
suite
]
=
list
(
)
if
not
suite
in
kats
:
kats
[
suite
]
=
list
()
for
file
in
os
.
listdir
(
suite_path
):
if
file
.
endswith
(
".kat"
):
kats
[
suite
].
append
(
str
(
file
))
for
file
in
os
.
listdir
(
suite_path
):
if
file
.
endswith
(
".kat"
):
kats
[
suite
].
append
(
str
(
file
))
__finesse_start_test
(
commits_not_tested
,
kats
)
__finesse_start_test
(
commit
,
kats
)
except
utils
.
RunException
as
ex
:
print
"stderr"
,
ex
.
err
pass
except
Exception
as
ex
:
...
...
Write
Preview
Supports
Markdown
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