Skip to content

Commit 6cf3345

Browse files
committed
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.
1 parent 1946b5f commit 6cf3345

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

contrib/devtools/test-symbol-check.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,39 @@ def call_symbol_check(cc: List[str], source, executable, options):
1919
os.remove(executable)
2020
return (p.returncode, p.stdout.rstrip())
2121

22+
def get_machine(cc: List[str]):
23+
p = subprocess.run([*cc,'-dumpmachine'], stdout=subprocess.PIPE, universal_newlines=True)
24+
return p.stdout.rstrip()
25+
2226
class TestSymbolChecks(unittest.TestCase):
2327
def test_ELF(self):
2428
source = 'test1.c'
2529
executable = 'test1'
2630
cc = determine_wellknown_cmd('CC', 'gcc')
2731

28-
# renameat2 was introduced in GLIBC 2.28, so is newer than the upper limit
29-
# of glibc for all platforms
32+
# there's no way to do this test for RISC-V at the moment; we build for
33+
# RISC-V in a glibc 2.27 envinonment and we allow all symbols from 2.27.
34+
if 'riscv' in get_machine(cc):
35+
self.skipTest("test not available for RISC-V")
36+
37+
# nextup was introduced in GLIBC 2.24, so is newer than our supported
38+
# glibc (2.17), and available in our release build environment (2.24).
3039
with open(source, 'w', encoding="utf8") as f:
3140
f.write('''
3241
#define _GNU_SOURCE
33-
#include <stdio.h>
34-
#include <linux/fs.h>
42+
#include <math.h>
3543
36-
int renameat2(int olddirfd, const char *oldpath,
37-
int newdirfd, const char *newpath, unsigned int flags);
44+
double nextup(double x);
3845
3946
int main()
4047
{
41-
renameat2(0, "test", 0, "test_", RENAME_EXCHANGE);
48+
nextup(3.14);
4249
return 0;
4350
}
4451
''')
4552

46-
self.assertEqual(call_symbol_check(cc, source, executable, []),
47-
(1, executable + ': symbol renameat2 from unsupported version GLIBC_2.28\n' +
53+
self.assertEqual(call_symbol_check(cc, source, executable, ['-lm']),
54+
(1, executable + ': symbol nextup from unsupported version GLIBC_2.24\n' +
4855
executable + ': failed IMPORTED_SYMBOLS'))
4956

5057
# -lutil is part of the libc6 package so a safe bet that it's installed

0 commit comments

Comments
 (0)