scripts: adjust test-symbol-check for guix release environment

Now that our release binaries are build in a glibc 2.24 and 2.27
environment, we can't use a symbol from glibc 2.28 to test our checks.
Replace renameat2() with nextup(), which was introduced in 2.24.

Note that this also means re-disabling the test for RISC-V, however
RISC-V is built in a glibc 2.27 environment, and our minimum required
glibc for that binary is 2.27.
pull/826/head
fanquake 3 years ago
parent 1946b5f77c
commit 6cf3345297
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

@ -19,32 +19,39 @@ def call_symbol_check(cc: List[str], source, executable, options):
os.remove(executable)
return (p.returncode, p.stdout.rstrip())
def get_machine(cc: List[str]):
p = subprocess.run([*cc,'-dumpmachine'], stdout=subprocess.PIPE, universal_newlines=True)
return p.stdout.rstrip()
class TestSymbolChecks(unittest.TestCase):
def test_ELF(self):
source = 'test1.c'
executable = 'test1'
cc = determine_wellknown_cmd('CC', 'gcc')
# renameat2 was introduced in GLIBC 2.28, so is newer than the upper limit
# of glibc for all platforms
# there's no way to do this test for RISC-V at the moment; we build for
# RISC-V in a glibc 2.27 envinonment and we allow all symbols from 2.27.
if 'riscv' in get_machine(cc):
self.skipTest("test not available for RISC-V")
# nextup was introduced in GLIBC 2.24, so is newer than our supported
# glibc (2.17), and available in our release build environment (2.24).
with open(source, 'w', encoding="utf8") as f:
f.write('''
#define _GNU_SOURCE
#include <stdio.h>
#include <linux/fs.h>
#include <math.h>
int renameat2(int olddirfd, const char *oldpath,
int newdirfd, const char *newpath, unsigned int flags);
double nextup(double x);
int main()
{
renameat2(0, "test", 0, "test_", RENAME_EXCHANGE);
nextup(3.14);
return 0;
}
''')
self.assertEqual(call_symbol_check(cc, source, executable, []),
(1, executable + ': symbol renameat2 from unsupported version GLIBC_2.28\n' +
self.assertEqual(call_symbol_check(cc, source, executable, ['-lm']),
(1, executable + ': symbol nextup from unsupported version GLIBC_2.24\n' +
executable + ': failed IMPORTED_SYMBOLS'))
# -lutil is part of the libc6 package so a safe bet that it's installed

Loading…
Cancel
Save