musl: test: several random fixlets for unit tests

This commit is contained in:
Yu Watanabe
2025-11-14 03:29:21 +09:00
parent be33b202e6
commit aec0e63a4f
6 changed files with 58 additions and 11 deletions
+1
View File
@@ -17,6 +17,7 @@ test_env = {
'SYSTEMD_DEFAULT_LOCALE' : get_option('default-locale'),
'SYSTEMD_SLOW_TESTS' : want_slow_tests ? '1' : '0',
'PYTHONDONTWRITEBYTECODE' : '1',
'SYSTEMD_LIBC' : get_option('libc'),
}
if conf.get('ENABLE_LOCALED') == 1
test_env += {'SYSTEMD_LANGUAGE_FALLBACK_MAP' : language_fallback_map}
+1 -1
View File
@@ -127,7 +127,7 @@ TEST(os_release_support_ended) {
ASSERT_TRUE(os_release_support_ended("1999-01-01", false, NULL));
ASSERT_FALSE(os_release_support_ended("2037-12-31", false, NULL));
assert_se(os_release_support_ended("-1-1-1", true, NULL) == -EINVAL);
ASSERT_ERROR(os_release_support_ended("1-1-1", true, NULL), ERANGE);
r = os_release_support_ended(NULL, false, NULL);
if (r < 0)
+5 -1
View File
@@ -559,7 +559,11 @@ TEST(memory_deny_write_execute_mmap) {
p = mmap(NULL, page_size(), PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
#if defined(__x86_64__) || defined(__i386__) || defined(__powerpc64__) || defined(__arm__) || defined(__aarch64__) || defined(__loongarch_lp64)
assert_se(p == MAP_FAILED);
assert_se(errno == EPERM);
# ifdef __GLIBC__
ASSERT_EQ(errno, EPERM);
# else
ASSERT_EQ(errno, ENOMEM); /* musl maps EPERM to ENOMEM. See src/mman/mmap.c in musl. */
# endif
#endif
/* Depending on kernel, libseccomp, and glibc versions, other architectures
* might fail or not. Let's not assert success. */