git » libfiu » commit 1410a50

tests/generated: Add 64-bit variant for mmap

author Alberto Bertogli
2024-06-28 19:24:27 UTC
committer Alberto Bertogli
2024-06-28 19:26:09 UTC
parent e1195627480af97ef415ea852e83d0d43ade0b12

tests/generated: Add 64-bit variant for mmap

This patch adds a mmap test which explicitly sets _FILE_OFFSET_BITS=64,
to make sure it works on both the "normal" case (which depends on the
platform) as well as the 64-bit case.

tests/generated/generate-test +4 -0
tests/generated/tests/mmap64.conf +13 -0

diff --git a/tests/generated/generate-test b/tests/generated/generate-test
index 7fc0804..9113d3e 100755
--- a/tests/generated/generate-test
+++ b/tests/generated/generate-test
@@ -97,6 +97,9 @@ int main(void) {
 def generate(options, outfile):
 	outfile.write("/* AUTOGENERATED FILE - DO NOT EDIT */\n\n")
 
+	if 'defines' in options:
+		outfile.write("%s\n" % options['defines'])
+
 	outfile.write("#include <fiu.h>\n")
 	outfile.write("#include <fiu-control.h>\n")
 	outfile.write("#include <stdio.h>\n")
@@ -145,6 +148,7 @@ def main():
 
 	# Defaults for the optional configuration parameters.
 	conf_defaults = {
+		'defines': '',
 		'include': (),
 		'prep': '',
 
diff --git a/tests/generated/tests/mmap64.conf b/tests/generated/tests/mmap64.conf
new file mode 100644
index 0000000..469a16c
--- /dev/null
+++ b/tests/generated/tests/mmap64.conf
@@ -0,0 +1,13 @@
+
+[mmap64]
+fp: posix/mm/mmap
+defines: #define _FILE_OFFSET_BITS 64
+include: sys/mman.h unistd.h
+if: defined _POSIX_MAPPED_FILES
+prep: void *p;
+call: p = mmap(NULL, 4092, PROT_READ | PROT_WRITE,
+		MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+success_cond: p != MAP_FAILED
+failure_cond: p == MAP_FAILED
+errno_on_fail: ETXTBSY
+