1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-21 02:50:18 +03:00

Merge pull request #21848 from yuwata/errno-name-drop-aliases

errno-name: drop aliases defined for specific arch
This commit is contained in:
Yu Watanabe 2021-12-22 17:27:12 +09:00 committed by GitHub
commit a9cab9f5cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 0 deletions

View File

@ -3,5 +3,9 @@
set -eu
set -o pipefail
# In kernel's arch/parisc/include/uapi/asm/errno.h, ECANCELLED and EREFUSED are defined as aliases of
# ECANCELED and ECONNREFUSED, respectively. Let's drop them.
${1:?} -dM -include errno.h - </dev/null | \
grep -Ev '^#define[[:space:]]+(ECANCELLED|EREFUSED)' | \
awk '/^#define[ \t]+E[^ _]+[ \t]+/ { print $2; }'

View File

@ -574,6 +574,9 @@ tests += [
[['src/test/test-arphrd-util.c',
generated_gperf_headers]],
[['src/test/test-errno-list.c',
generated_gperf_headers]],
[['src/test/test-ip-protocol-list.c',
shared_generated_gperf_headers]],

View File

@ -0,0 +1,33 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include "errno-list.h"
#include "errno-to-name.h"
#include "macro.h"
#include "string-util.h"
#include "tests.h"
#include "util.h"
TEST(errno_list) {
for (size_t i = 0; i < ELEMENTSOF(errno_names); i++) {
if (errno_names[i]) {
assert_se(streq(errno_to_name(i), errno_names[i]));
assert_se(errno_from_name(errno_names[i]) == (int) i);
}
}
#ifdef ECANCELLED
/* ECANCELLED is an alias of ECANCELED. */
assert_se(streq(errno_to_name(ECANCELLED), "ECANCELED"));
#endif
assert_se(streq(errno_to_name(ECANCELED), "ECANCELED"));
#ifdef EREFUSED
/* EREFUSED is an alias of ECONNREFUSED. */
assert_se(streq(errno_to_name(EREFUSED), "ECONNREFUSED"));
#endif
assert_se(streq(errno_to_name(ECONNREFUSED), "ECONNREFUSED"));
}
DEFINE_TEST_MAIN(LOG_INFO);