Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
2e386bd4
Commit
2e386bd4
authored
Jun 08, 2011
by
Stephen Morris
Browse files
[trac976] Reformat shell test output
parent
dd46abf6
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/lib/log/tests/console_test.sh.in
View file @
2e386bd4
...
...
@@ -28,29 +28,29 @@ tempfile=@abs_builddir@/console_test_tempfile_$$
passfail
()
{
count
=
`
wc
-l
$tempfile
|
awk
'{print $1}'
`
if
[
$count
-eq
$1
]
;
then
echo
"
--
pass"
echo
" pass"
else
echo
"
**
FAIL"
echo
" FAIL"
failcount
=
`
expr
$failcount
+
$1
`
fi
}
echo
"1. Checking that console output to stdout goes to stdout:"
echo
-n
"1. Checking that console output to stdout goes to stdout:"
rm
-f
$tempfile
./logger_example
-c
stdout
-s
error 1>
$tempfile
2> /dev/null
passfail 4
echo
"2. Checking that console output to stdout does not go to stderr:"
echo
-n
"2. Checking that console output to stdout does not go to stderr:"
rm
-f
$tempfile
./logger_example
-c
stdout
-s
error 1> /dev/null 2>
$tempfile
passfail 0
echo
"3. Checking that console output to stderr goes to stderr:"
echo
-n
"3. Checking that console output to stderr goes to stderr:"
rm
-f
$tempfile
./logger_example
-c
stderr
-s
error 1> /dev/null 2>
$tempfile
passfail 4
echo
"4. Checking that console output to stderr does not go to stdout:"
echo
-n
"4. Checking that console output to stderr does not go to stdout:"
rm
-f
$tempfile
./logger_example
-c
stderr
-s
error 1>
$tempfile
2> /dev/null
passfail 0
...
...
src/lib/log/tests/destination_test.sh.in
View file @
2e386bd4
...
...
@@ -28,14 +28,14 @@ destfile2=@abs_builddir@/destination_test_destfile_2_$$
passfail
()
{
if
[
$1
-eq
0
]
;
then
echo
"
--
pass"
echo
" pass"
else
echo
"
**
FAIL"
echo
" FAIL"
failcount
=
`
expr
$failcount
+
$1
`
fi
}
echo
"1. One logger, multiple destinations"
echo
"1. One logger, multiple destinations
:
"
cat
>
$tempfile
<<
.
FATAL
[
example] MSG_WRITERR, error writing to test1: 42
ERROR
[
example] MSG_RDLOCMES, reading
local
message file dummy/file
...
...
@@ -44,12 +44,16 @@ ERROR [example.beta] MSG_BADDESTINATION, unrecognized log destination: beta_erro
.
rm
-f
$destfile1
$destfile2
./logger_example
-s
error
-f
$destfile1
-f
$destfile2
echo
-n
" - destination 1:"
cut
-d
' '
-f3-
$destfile1
| diff
$tempfile
-
passfail
$?
echo
-n
" - destination 2:"
cut
-d
' '
-f3-
$destfile2
| diff
$tempfile
-
passfail
$?
echo
"2. Two loggers, different destinations and severities"
echo
"2. Two loggers, different destinations and severities"
rm
-f
$destfile1
$destfile2
./logger_example
-l
example
-s
info
-f
$destfile1
-l
alpha
-s
warn
-f
$destfile2
...
...
@@ -65,9 +69,11 @@ ERROR [example.beta] MSG_BADDESTINATION, unrecognized log destination: beta_erro
WARN
[
example.beta] MSG_BADSTREAM, bad log console output stream: beta_warn
INFO
[
example.beta] MSG_READERR, error reading from message file beta: info
.
echo
-n
" - destination 1:"
cut
-d
' '
-f3-
$destfile1
| diff
$tempfile
-
passfail
$?
echo
-n
" - destination 2:"
cat
>
$tempfile
<<
.
WARN
[
example.alpha] MSG_READERR, error reading from message file a.txt: dummy reason
.
...
...
src/lib/log/tests/local_file_test.sh.in
View file @
2e386bd4
...
...
@@ -27,9 +27,9 @@ tempfile=@abs_builddir@/run_time_init_test_tempfile_$$
passfail
()
{
if
[
$1
-eq
0
]
;
then
echo
"
--
pass"
echo
" pass"
else
echo
"
**
FAIL"
echo
" FAIL"
failcount
=
`
expr
$failcount
+
$1
`
fi
}
...
...
@@ -43,7 +43,7 @@ cat > $localmes << .
% RDLOCMES replacement
read local
message file, parameter is
'%1'
.
echo
"1. Local message replacement:"
echo
-n
"1. Local message replacement:"
cat
>
$tempfile
<<
.
WARN
[
example.log] MSG_IDNOTFND, could not replace message text
for
'MSG_NOTHERE'
: no such message
FATAL
[
example] MSG_WRITERR, error writing to test1: 42
...
...
@@ -57,7 +57,7 @@ WARN [example.beta] MSG_BADSTREAM, bad log console output stream: beta_warn
./logger_example
-c
stdout
-s
warn
$localmes
|
cut
-d
' '
-f3-
| diff
$tempfile
-
passfail
$?
echo
"2. Report error if unable to read local message file:"
echo
-n
"2. Report error if unable to read local message file:"
cat
>
$tempfile
<<
.
ERROR
[
example.log] MSG_OPENIN, unable to open message file
$localmes
for
input: No such file or directory
FATAL
[
example] MSG_WRITERR, error writing to test1: 42
...
...
src/lib/log/tests/severity_test.sh.in
View file @
2e386bd4
...
...
@@ -26,14 +26,14 @@ tempfile=@abs_builddir@/severity_test_tempfile_$$
passfail
()
{
if
[
$1
-eq
0
]
;
then
echo
"
--
pass"
echo
" pass"
else
echo
"
**
FAIL"
echo
" FAIL"
failcount
=
`
expr
$failcount
+
$1
`
fi
}
echo
"1. runInitTest default parameters:
"
echo
-n
"1. runInitTest default parameters:"
cat
>
$tempfile
<<
.
FATAL
[
example] MSG_WRITERR, error writing to test1: 42
ERROR
[
example] MSG_RDLOCMES, reading
local
message file dummy/file
...
...
@@ -48,7 +48,7 @@ INFO [example.beta] MSG_READERR, error reading from message file beta: info
./logger_example
-c
stdout |
cut
-d
' '
-f3-
| diff
$tempfile
-
passfail
$?
echo
"2. Severity filter:
"
echo
-n
"2. Severity filter:"
cat
>
$tempfile
<<
.
FATAL
[
example] MSG_WRITERR, error writing to test1: 42
ERROR
[
example] MSG_RDLOCMES, reading
local
message file dummy/file
...
...
@@ -58,7 +58,7 @@ ERROR [example.beta] MSG_BADDESTINATION, unrecognized log destination: beta_erro
./logger_example
-c
stdout
-s
error |
cut
-d
' '
-f3-
| diff
$tempfile
-
passfail
$?
echo
"3. Debug level:
"
echo
-n
"3. Debug level:"
cat
>
$tempfile
<<
.
FATAL
[
example] MSG_WRITERR, error writing to test1: 42
ERROR
[
example] MSG_RDLOCMES, reading
local
message file dummy/file
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment