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
Container Registry
Model registry
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
The Tor Project
Core
Tor
Commits
8377b610
Commit
8377b610
authored
5 years ago
by
George Kadianakis
Browse files
Options
Downloads
Plain Diff
Merge branch 'tor-github/pr/1327'
parents
f6ea8902
8ad41974
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/test_parseconf.sh
+23
-9
23 additions, 9 deletions
src/test/test_parseconf.sh
with
23 additions
and
9 deletions
src/test/test_parseconf.sh
+
23
−
9
View file @
8377b610
...
...
@@ -39,11 +39,10 @@
umask
077
set
-e
die
()
{
echo
"
$1
"
>
&2
;
exit
5
;
}
# emulate realpath(), in case coreutils or equivalent is not installed.
abspath
()
{
f
=
$@
f
=
"
$*
"
if
[
-d
"
$f
"
]
;
then
dir
=
"
$f
"
base
=
""
...
...
@@ -68,7 +67,6 @@ TOR_BINARY="$(abspath "$TOR_BINARY")"
# make a safe space for temporary files
DATA_DIR
=
$(
mktemp
-d
-t
tor_parseconf_tests.XXXXXX
)
trap
'rm -rf "$DATA_DIR"'
0
touch
"
${
DATA_DIR
}
/EMPTY"
||
die
"Couldn't create empty file."
# This is where we look for examples
EXAMPLEDIR
=
"
$(
dirname
"
$0
"
)
"
/conf_examples
...
...
@@ -80,12 +78,28 @@ case "$(uname -s)" in
*
)
WINDOWS
=
0
;;
esac
####
# BUG WORKAROUND FOR 31757:
# On Appveyor, it seems that Tor sometimes randomly fails to produce
# output with --dump-config. Whil we are figuring this out, do not treat
# windows errors as hard failures.
####
if
test
"
$WINDOWS
"
=
1
;
then
EXITCODE
=
0
else
EXITCODE
=
1
fi
die
()
{
echo
"
$1
"
>
&2
;
exit
"
$EXITCODE
"
;
}
if
test
"
$WINDOWS
"
=
1
;
then
FILTER
=
"dos2unix"
else
FILTER
=
"cat"
fi
touch
"
${
DATA_DIR
}
/EMPTY"
||
die
"Couldn't create empty file."
for
dir
in
"
${
EXAMPLEDIR
}
"
/
*
;
do
if
!
test
-d
"
${
dir
}
"
;
then
# Only count directories.
...
...
@@ -115,7 +129,7 @@ for dir in "${EXAMPLEDIR}"/*; do
if
test
-f
"./error"
;
then
echo
"FAIL: Found both
${
dir
}
/expected and
${
dir
}
/error."
echo
"(Only one of these files should exist.)"
exit
1
exit
$EXITCODE
fi
# This case should succeed: run dump-config and see if it does.
...
...
@@ -139,7 +153,7 @@ for dir in "${EXAMPLEDIR}"/*; do
if
!
cmp
"
${
DATA_DIR
}
/output.
${
testname
}
"
\
"
${
DATA_DIR
}
/output_2.
${
testname
}
"
;
then
echo
"Failure: did not match on round-trip."
exit
1
exit
$EXITCODE
fi
echo
"OK"
...
...
@@ -152,8 +166,8 @@ for dir in "${EXAMPLEDIR}"/*; do
--verify-config
\
${
CMDLINE
}
||
true
fi
diff
-u
"./expected"
"
${
DATA_DIR
}
/output.
${
testname
}
"
exit
1
diff
-u
"./expected"
"
${
DATA_DIR
}
/output.
${
testname
}
"
||
/bin/true
exit
$EXITCODE
fi
elif
test
-f
"./error"
;
then
...
...
@@ -174,7 +188,7 @@ for dir in "${EXAMPLEDIR}"/*; do
echo
"Expected error:
${
expect_err
}
"
echo
"Tor said:"
cat
"
${
DATA_DIR
}
/output.
${
testname
}
"
exit
1
exit
$EXITCODE
fi
else
...
...
@@ -182,7 +196,7 @@ for dir in "${EXAMPLEDIR}"/*; do
# call that an error.
echo
"FAIL: Did not find
${
dir
}
/expected or
${
dir
}
/error."
exit
1
exit
$EXITCODE
fi
cd
"
${
PREV_DIR
}
"
...
...
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