Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
50 lines
1.5 KiB
C
50 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <linux/kernel.h>
|
|
#include "debug.h"
|
|
#include "symbol.h"
|
|
#include "tests.h"
|
|
|
|
static int test__demangle_java(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
|
|
{
|
|
int ret = TEST_OK;
|
|
char *buf = NULL;
|
|
size_t i;
|
|
|
|
struct {
|
|
const char *mangled, *demangled;
|
|
} test_cases[] = {
|
|
{ "Ljava/lang/StringLatin1;equals([B[B)Z",
|
|
"java.lang.StringLatin1.equals(byte[], byte[])" },
|
|
{ "Ljava/util/zip/ZipUtils;CENSIZ([BI)J",
|
|
"java.util.zip.ZipUtils.CENSIZ(byte[], int)" },
|
|
{ "Ljava/util/regex/Pattern$BmpCharProperty;match(Ljava/util/regex/Matcher;ILjava/lang/CharSequence;)Z",
|
|
"java.util.regex.Pattern$BmpCharProperty.match(java.util.regex.Matcher, int, java.lang.CharSequence)" },
|
|
{ "Ljava/lang/AbstractStringBuilder;appendChars(Ljava/lang/String;II)V",
|
|
"java.lang.AbstractStringBuilder.appendChars(java.lang.String, int, int)" },
|
|
{ "Ljava/lang/Object;<init>()V",
|
|
"java.lang.Object<init>()" },
|
|
};
|
|
|
|
for (i = 0; i < ARRAY_SIZE(test_cases); i++) {
|
|
buf = dso__demangle_sym(/*dso=*/NULL, /*kmodule=*/0, test_cases[i].mangled);
|
|
if (!buf) {
|
|
pr_debug("FAILED to demangle: \"%s\"\n \"%s\"\n", test_cases[i].mangled,
|
|
test_cases[i].demangled);
|
|
continue;
|
|
}
|
|
if (strcmp(buf, test_cases[i].demangled)) {
|
|
pr_debug("FAILED: %s: %s != %s\n", test_cases[i].mangled,
|
|
buf, test_cases[i].demangled);
|
|
ret = TEST_FAIL;
|
|
}
|
|
free(buf);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
DEFINE_SUITE("Demangle Java", demangle_java);
|