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) os.remove(executable)
return (p.returncode, p.stdout.rstrip()) 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): class TestSymbolChecks(unittest.TestCase):
def test_ELF(self): def test_ELF(self):
source = 'test1.c' source = 'test1.c'
executable = 'test1' executable = 'test1'
cc = determine_wellknown_cmd('CC', 'gcc') cc = determine_wellknown_cmd('CC', 'gcc')
# renameat2 was introduced in GLIBC 2.28, so is newer than the upper limit # there's no way to do this test for RISC-V at the moment; we build for
# of glibc for all platforms # 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: with open(source, 'w', encoding="utf8") as f:
f.write(''' f.write('''
#define _GNU_SOURCE #define _GNU_SOURCE
#include <stdio.h> #include <math.h>
#include <linux/fs.h>
int renameat2(int olddirfd, const char *oldpath, double nextup(double x);
int newdirfd, const char *newpath, unsigned int flags);
int main() int main()
{ {
renameat2(0, "test", 0, "test_", RENAME_EXCHANGE); nextup(3.14);
return 0; return 0;
} }
''') ''')
self.assertEqual(call_symbol_check(cc, source, executable, []), self.assertEqual(call_symbol_check(cc, source, executable, ['-lm']),
(1, executable + ': symbol renameat2 from unsupported version GLIBC_2.28\n' + (1, executable + ': symbol nextup from unsupported version GLIBC_2.24\n' +
executable + ': failed IMPORTED_SYMBOLS')) executable + ': failed IMPORTED_SYMBOLS'))
# -lutil is part of the libc6 package so a safe bet that it's installed # -lutil is part of the libc6 package so a safe bet that it's installed

Loading…
Cancel
Save