aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2014-12-30 12:38:52 -0800
committerGerald Combs <gerald@wireshark.org>2014-12-30 21:20:28 +0000
commitdcbebe0eaccfba338eaa11df17197ab0f928766a (patch)
tree74c54e923e5371eb056a96da65aac3bd9d3ab3cd
parent3b578619098dc86e69a2ddbbc5b10d0fdb062537 (diff)
Test suite: Start testing our output for valid UTF-8.
Feed the output of `tshark -G <glossary>` to `iconv -f UTF-8`. Adjust a couple of the Bluetooth dissectors and X11 keysyms accordingly. Change-Id: I5b04dc3fa4734c8f0a795daf44bd398fe5ebc1bd Reviewed-on: https://code.wireshark.org/review/6146 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r--epan/dissectors/packet-bthci_cmd.c7
-rw-r--r--epan/dissectors/packet-bthci_evt.c5
-rw-r--r--epan/dissectors/x11-keysym.h196
-rwxr-xr-xtest/config.sh3
-rwxr-xr-xtest/suite-clopts.sh19
5 files changed, 131 insertions, 99 deletions
diff --git a/epan/dissectors/packet-bthci_cmd.c b/epan/dissectors/packet-bthci_cmd.c
index 4fd223acaf..8c3a4be3e8 100644
--- a/epan/dissectors/packet-bthci_cmd.c
+++ b/epan/dissectors/packet-bthci_cmd.c
@@ -1206,9 +1206,12 @@ static const value_string cmd_authentication_enable_values[] = {
{0, NULL }
};
+/* XXX - Should be pulled from utf8_entities.h */
+#define UTF8_MICRO_SIGN "\xc2\xb5" /* 181 / 0xb5 */
+
static const value_string cmd_input_coding_values[] = {
{0x0, "Linear" },
- {0x1, "\xb5-law" },
+ {0x1, UTF8_MICRO_SIGN "-law" },
{0x2, "A-law" },
{0, NULL }
};
@@ -1232,7 +1235,7 @@ value_string_ext bthci_cmd_input_sample_size_vals_ext = VALUE_STRING_EXT_INIT(cm
static const value_string cmd_air_coding_format_values[] = {
{0x0, "CVSD" },
- {0x1, "\xb5-law" },
+ {0x1, UTF8_MICRO_SIGN "-law" },
{0x2, "A-law" },
{0x3, "Transparent" },
{0, NULL }
diff --git a/epan/dissectors/packet-bthci_evt.c b/epan/dissectors/packet-bthci_evt.c
index 3626fffd74..960e329b14 100644
--- a/epan/dissectors/packet-bthci_evt.c
+++ b/epan/dissectors/packet-bthci_evt.c
@@ -680,8 +680,11 @@ static const value_string evt_master_clock_accuray[] = {
{ 0, NULL }
};
+/* XXX - Should be pulled from utf8_entities.h */
+#define UTF8_MICRO_SIGN "\xc2\xb5" /* 181 / 0xb5 */
+
static const value_string evt_air_mode_vals[] = {
- { 0x00, "\xb5-law log" },
+ { 0x00, UTF8_MICRO_SIGN "-law log" },
{ 0x01, "A-law log" },
{ 0x02, "CVSD" },
{ 0x03, "Transparent Data" },
diff --git a/epan/dissectors/x11-keysym.h b/epan/dissectors/x11-keysym.h
index fd4ea9d9e8..6009002d32 100644
--- a/epan/dissectors/x11-keysym.h
+++ b/epan/dissectors/x11-keysym.h
@@ -23,7 +23,9 @@
*/
/* Note; Entries should be kept in ascending order so that val_to_str_ext()
- * and etc can do the lookup using a binary search.
+ * and etc can do the lookup using a binary search.
+ *
+ * Strings must be valid UTF-8 sequences.
*/
static const value_string x11_keysym_vals_source[] = {
@@ -124,101 +126,103 @@ static const value_string x11_keysym_vals_source[] = {
{ 0x07d, ", HFILL }" },
{ 0x07e, "~" },
{ 0x0a0, "nobreakspace" },
- { 0x0a1, "\x0a1" },
- { 0x0a2, "\x0a2" },
- { 0x0a3, "\x0a3" },
- { 0x0a4, "\x0a4" },
- { 0x0a5, "\x0a5" },
- { 0x0a6, "\x0a6" },
- { 0x0a7, "\x0a7" },
- { 0x0a8, "\x0a8" },
- { 0x0a9, "\x0a9" },
- { 0x0aa, "\x0aa" },
- { 0x0ab, "\x0ab" },
- { 0x0ac, "\x0ac" },
- { 0x0ad, "\x0ad" },
- { 0x0ae, "\x0ae" },
- { 0x0af, "\x0af" },
- { 0x0b0, "\x0b0" },
- { 0x0b1, "\x0b1" },
- { 0x0b2, "\x0b2" },
- { 0x0b3, "\x0b3" },
- { 0x0b4, "\x0b4" },
- { 0x0b5, "\x0b5" },
- { 0x0b6, "\x0b6" },
- { 0x0b7, "\x0b7" },
- { 0x0b8, "\x0b8" },
- { 0x0b9, "\x0b9" },
- { 0x0ba, "\x0ba" },
- { 0x0bb, "\x0bb" },
- { 0x0bc, "\x0bc" },
- { 0x0bd, "\x0bd" },
- { 0x0be, "\x0be" },
- { 0x0bf, "\x0bf" },
- { 0x0c0, "\x0c0" },
- { 0x0c1, "\x0c1" },
- { 0x0c2, "\x0c2" },
- { 0x0c3, "\x0c3" },
- { 0x0c4, "\x0c4" },
- { 0x0c5, "\x0c5" },
- { 0x0c6, "\x0c6" },
- { 0x0c7, "\x0c7" },
- { 0x0c8, "\x0c8" },
- { 0x0c9, "\x0c9" },
- { 0x0ca, "\x0ca" },
- { 0x0cb, "\x0cb" },
- { 0x0cc, "\x0cc" },
- { 0x0cd, "\x0cd" },
- { 0x0ce, "\x0ce" },
- { 0x0cf, "\x0cf" },
- { 0x0d0, "\x0d0" },
- { 0x0d1, "\x0d1" },
- { 0x0d2, "\x0d2" },
- { 0x0d3, "\x0d3" },
- { 0x0d4, "\x0d4" },
- { 0x0d5, "\x0d5" },
- { 0x0d6, "\x0d6" },
- { 0x0d7, "\x0d7" },
- { 0x0d8, "\x0d8" },
- { 0x0d9, "\x0d9" },
- { 0x0da, "\x0da" },
- { 0x0db, "\x0db" },
- { 0x0dc, "\x0dc" },
- { 0x0dd, "\x0dd" },
- { 0x0de, "\x0de" },
- { 0x0df, "\x0df" },
- { 0x0e0, "\x0e0" },
- { 0x0e1, "\x0e1" },
- { 0x0e2, "\x0e2" },
- { 0x0e3, "\x0e3" },
- { 0x0e4, "\x0e4" },
- { 0x0e5, "\x0e5" },
- { 0x0e6, "\x0e6" },
- { 0x0e7, "\x0e7" },
- { 0x0e8, "\x0e8" },
- { 0x0e9, "\x0e9" },
- { 0x0ea, "\x0ea" },
- { 0x0eb, "\x0eb" },
- { 0x0ec, "\x0ec" },
- { 0x0ed, "\x0ed" },
- { 0x0ee, "\x0ee" },
- { 0x0ef, "\x0ef" },
- { 0x0f0, "\x0f0" },
- { 0x0f1, "\x0f1" },
- { 0x0f2, "\x0f2" },
- { 0x0f3, "\x0f3" },
- { 0x0f4, "\x0f4" },
- { 0x0f5, "\x0f5" },
- { 0x0f6, "\x0f6" },
- { 0x0f7, "\x0f7" },
- { 0x0f8, "\x0f8" },
- { 0x0f9, "\x0f9" },
- { 0x0fa, "\x0fa" },
- { 0x0fb, "\x0fb" },
- { 0x0fc, "\x0fc" },
- { 0x0fd, "\x0fd" },
- { 0x0fe, "\x0fe" },
- { 0x0ff, "\x0ff" },
+
+ /* Map raw Latin 1 / 8859-1 to Latin-1 Supplement UTF-8 sequences */
+ { 0x0a1, "\xc2\xa1" },
+ { 0x0a2, "\xc2\xa2" },
+ { 0x0a3, "\xc2\xa3" },
+ { 0x0a4, "\xc2\xa4" },
+ { 0x0a5, "\xc2\xa5" },
+ { 0x0a6, "\xc2\xa6" },
+ { 0x0a7, "\xc2\xa7" },
+ { 0x0a8, "\xc2\xa8" },
+ { 0x0a9, "\xc2\xa9" },
+ { 0x0aa, "\xc2\xaa" },
+ { 0x0ab, "\xc2\xab" },
+ { 0x0ac, "\xc2\xac" },
+ { 0x0ad, "\xc2\xad" },
+ { 0x0ae, "\xc2\xae" },
+ { 0x0af, "\xc2\xaf" },
+ { 0x0b0, "\xc2\xb0" },
+ { 0x0b1, "\xc2\xb1" },
+ { 0x0b2, "\xc2\xb2" },
+ { 0x0b3, "\xc2\xb3" },
+ { 0x0b4, "\xc2\xb4" },
+ { 0x0b5, "\xc2\xb5" },
+ { 0x0b6, "\xc2\xb6" },
+ { 0x0b7, "\xc2\xb7" },
+ { 0x0b8, "\xc2\xb8" },
+ { 0x0b9, "\xc2\xb9" },
+ { 0x0ba, "\xc2\xba" },
+ { 0x0bb, "\xc2\xbb" },
+ { 0x0bc, "\xc2\xbc" },
+ { 0x0bd, "\xc2\xbd" },
+ { 0x0be, "\xc2\xbe" },
+ { 0x0bf, "\xc2\xbf" },
+ { 0x0c0, "\xc3\x80" },
+ { 0x0c1, "\xc3\x81" },
+ { 0x0c2, "\xc3\x82" },
+ { 0x0c3, "\xc3\x83" },
+ { 0x0c4, "\xc3\x84" },
+ { 0x0c5, "\xc3\x85" },
+ { 0x0c6, "\xc3\x86" },
+ { 0x0c7, "\xc3\x87" },
+ { 0x0c8, "\xc3\x88" },
+ { 0x0c9, "\xc3\x89" },
+ { 0x0ca, "\xc3\x8a" },
+ { 0x0cb, "\xc3\x8b" },
+ { 0x0cc, "\xc3\x8c" },
+ { 0x0cd, "\xc3\x8d" },
+ { 0x0ce, "\xc3\x8e" },
+ { 0x0cf, "\xc3\x8f" },
+ { 0x0d0, "\xc3\x90" },
+ { 0x0d1, "\xc3\x91" },
+ { 0x0d2, "\xc3\x92" },
+ { 0x0d3, "\xc3\x93" },
+ { 0x0d4, "\xc3\x94" },
+ { 0x0d5, "\xc3\x95" },
+ { 0x0d6, "\xc3\x96" },
+ { 0x0d7, "\xc3\x97" },
+ { 0x0d8, "\xc3\x98" },
+ { 0x0d9, "\xc3\x99" },
+ { 0x0da, "\xc3\x9a" },
+ { 0x0db, "\xc3\x9b" },
+ { 0x0dc, "\xc3\x9c" },
+ { 0x0dd, "\xc3\x9d" },
+ { 0x0de, "\xc3\x9e" },
+ { 0x0df, "\xc3\x9f" },
+ { 0x0e0, "\xc3\xa0" },
+ { 0x0e1, "\xc3\xa1" },
+ { 0x0e2, "\xc3\xa2" },
+ { 0x0e3, "\xc3\xa3" },
+ { 0x0e4, "\xc3\xa4" },
+ { 0x0e5, "\xc3\xa5" },
+ { 0x0e6, "\xc3\xa6" },
+ { 0x0e7, "\xc3\xa7" },
+ { 0x0e8, "\xc3\xa8" },
+ { 0x0e9, "\xc3\xa9" },
+ { 0x0ea, "\xc3\xaa" },
+ { 0x0eb, "\xc3\xab" },
+ { 0x0ec, "\xc3\xac" },
+ { 0x0ed, "\xc3\xad" },
+ { 0x0ee, "\xc3\xae" },
+ { 0x0ef, "\xc3\xaf" },
+ { 0x0f0, "\xc3\xb0" },
+ { 0x0f1, "\xc3\xb1" },
+ { 0x0f2, "\xc3\xb2" },
+ { 0x0f3, "\xc3\xb3" },
+ { 0x0f4, "\xc3\xb4" },
+ { 0x0f5, "\xc3\xb5" },
+ { 0x0f6, "\xc3\xb6" },
+ { 0x0f7, "\xc3\xb7" },
+ { 0x0f8, "\xc3\xb8" },
+ { 0x0f9, "\xc3\xb9" },
+ { 0x0fa, "\xc3\xba" },
+ { 0x0fb, "\xc3\xbb" },
+ { 0x0fc, "\xc3\xbc" },
+ { 0x0fd, "\xc3\xbd" },
+ { 0x0fe, "\xc3\xbe" },
+ { 0x0ff, "\xc3\xbf" },
{ 0x1a1, "Aogonek" },
{ 0x1a2, "breve" },
diff --git a/test/config.sh b/test/config.sh
index fc28e98874..5d2bae23c4 100755
--- a/test/config.sh
+++ b/test/config.sh
@@ -105,6 +105,9 @@ CAPTURE_DIR="$TESTS_DIR/captures/"
$TSHARK -v | grep -q "with Lua"
HAVE_LUA=$?
+HAVE_ICONV="False"
+hash iconv 2>/dev/null && HAVE_ICONV="True"
+
# Display our environment
##printf "\n ------- Info =-----------------\n"
diff --git a/test/suite-clopts.sh b/test/suite-clopts.sh
index 4f9a7f9e7c..eedffa4f93 100755
--- a/test/suite-clopts.sh
+++ b/test/suite-clopts.sh
@@ -290,12 +290,31 @@ test_dump_glossary() {
fi
}
+test_dump_glossary_utf8() {
+ if [ "$HAVE_ICONV" != "True" ] ; then
+ test_step_skipped
+ return
+ fi
+
+ $TSHARK -G $1 | iconv -f UTF-8 > /dev/null 2> ./testout.txt
+ RETURNVALUE=$?
+ if [ ! $RETURNVALUE -eq $EXIT_OK ]; then
+ if [ -s ./testout.txt ]; then
+ test_step_output_print ./testout.txt
+ fi
+ test_step_failed "exit status: $RETURNVALUE"
+ else
+ test_step_ok
+ fi
+}
+
# check that dumping the glossaries succeeds (at least doesn't crash)
# this catches extended value strings without the BASE_EXT_STRING flag
# among other problems
clopts_suite_dump_glossaries() {
for glossary in fields protocols values decodes defaultprefs currentprefs; do
test_step_add "Dumping $glossary glossary" "test_dump_glossary $glossary"
+ test_step_add "Testing $glossary output encoding" "test_dump_glossary_utf8 $glossary"
done
}