Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
orbea
Tor
Commits
320f5f30
Commit
320f5f30
authored
6 years ago
by
rl1987
Committed by
Nick Mathewson
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
In test_rebind.py, log stuff with timestamps
parent
e82023d2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/test_rebind.py
+9
-4
9 additions, 4 deletions
src/test/test_rebind.py
with
9 additions
and
4 deletions
src/test/test_rebind.py
+
9
−
4
View file @
320f5f30
from
__future__
import
print_function
import
errno
import
logging
import
os
import
random
import
socket
...
...
@@ -13,7 +14,7 @@ LOG_WAIT = 0.1
LOG_CHECK_LIMIT
=
LOG_TIMEOUT
/
LOG_WAIT
def
fail
(
msg
):
print
(
'
FAIL
'
)
logging
.
error
(
'
FAIL
'
)
sys
.
exit
(
msg
)
def
try_connecting_to_socksport
():
...
...
@@ -30,7 +31,7 @@ def wait_for_log(s):
l
=
l
.
decode
(
'
utf8
'
)
if
s
in
l
:
return
print
(
'
Tor logged:
"
{}
"
, waiting for
"
{}
"'
.
format
(
l
.
strip
(),
s
))
logging
.
info
(
'
Tor logged:
"
{}
"
, waiting for
"
{}
"'
.
format
(
l
.
strip
(),
s
))
# readline() returns a blank string when there is no output
# avoid busy-waiting
if
len
(
s
)
==
0
:
...
...
@@ -55,6 +56,10 @@ def pick_random_port():
return
port
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
format
=
'
%(asctime)s.%(msecs)03d %(message)s
'
,
datefmt
=
'
%Y-%m-%d %H:%M:%S
'
)
if
sys
.
hexversion
<
0x02070000
:
fail
(
"
ERROR: unsupported Python version (should be >= 2.7)
"
)
...
...
@@ -108,13 +113,13 @@ try_connecting_to_socksport()
control_socket
.
sendall
(
'
SIGNAL HALT
\r\n
'
.
encode
(
'
utf8
'
))
wait_for_log
(
'
exiting cleanly
'
)
print
(
'
OK
'
)
logging
.
info
(
'
OK
'
)
try
:
tor_process
.
terminate
()
except
OSError
as
e
:
if
e
.
errno
==
errno
.
ESRCH
:
# errno 3: No such process
# assume tor has already exited due to SIGNAL HALT
print
(
"
Tor has already exited
"
)
logging
.
warn
(
"
Tor has already exited
"
)
else
:
raise
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