-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor unicode.sh to use run_step()
Signed-off-by: Joachim Wiberg <[email protected]>
- Loading branch information
Showing
1 changed file
with
15 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
#!/bin/sh | ||
# Currently only same as local.sh but with unicode messages | ||
# From https://github.com/troglobit/sysklogd/issues/49 | ||
# shellcheck disable=SC1090 | ||
if [ -z "${srcdir}" ]; then | ||
srcdir=. | ||
fi | ||
. "${srcdir}/lib.sh" | ||
|
||
setup -8 | ||
|
||
MSG="öäüÖÄÜ߀¢§" | ||
MSG2="…‘’•" | ||
|
||
logger ${MSG} | ||
grep ${MSG} "${LOG}" || FAIL "Cannot find: ${MSG}" | ||
setup_unicode() | ||
{ | ||
setup -8 -m0 | ||
} | ||
|
||
check_log_message() | ||
{ | ||
message="${!#}" # Get last argument | ||
[ $# -gt 1 ] && altsock="$1" | ||
|
||
logger "${ALTSOCK}" ${MSG2} | ||
grep ${MSG2} "${LOG}" || FAIL "Cannot find: ${MSG2}" | ||
logger "${altsock}" "$message" | ||
grep "$message" "$LOG" | ||
} | ||
|
||
OK | ||
run_step "Set up unicode capable syslogd" setup_unicode | ||
run_step "Verify logger" check_log_message "$MSG" | ||
run_step "Verify logger w/ alt. socket" check_log_message "$ALTSOCK" "$MSG2" |