From patchwork Wed Jul 27 15:27:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fischer X-Patchwork-Id: 12930481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD99AC19F28 for ; Wed, 27 Jul 2022 15:34:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233553AbiG0PeY (ORCPT ); Wed, 27 Jul 2022 11:34:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233650AbiG0PeW (ORCPT ); Wed, 27 Jul 2022 11:34:22 -0400 Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5811C237F4 for ; Wed, 27 Jul 2022 08:34:19 -0700 (PDT) Received: (qmail 14981 invoked by uid 989); 27 Jul 2022 15:27:37 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) From: Florian Fischer To: io-uring@vger.kernel.org Cc: Florian Schmaus , Peter Eszlari , Florian Fischer Subject: [PATCH liburing 1/9] add Meson build system Date: Wed, 27 Jul 2022 17:27:15 +0200 Message-Id: <20220727152723.3320169-2-florian.fischer@muhq.space> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727152723.3320169-1-florian.fischer@muhq.space> References: <20220727152723.3320169-1-florian.fischer@muhq.space> MIME-Version: 1.0 X-Rspamd-Bar: -- X-Rspamd-Report: R_MISSING_CHARSET(0.5) MIME_GOOD(-0.1) REPLY(-4) BAYES_HAM(-1.039819) MID_CONTAINS_FROM(1) SUSPICIOUS_RECIPS(1.5) X-Rspamd-Score: -2.139819 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Wed, 27 Jul 2022 17:27:37 +0200 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org From: Peter Eszlari Meson is a fast and simple build system. Adoption started mainly in the desktop space (Gnome, X11, Mesa) to replace autotools, but since then, some low level projects (systemd, qemu) have switched to it too. Since liburing is a rather small codebase, the difference in speed and simplicity are not as huge as with other projects. Nonetheless, there are still some advantages: * It comes with some nice features (e.g. out-of-source builds), that one would need to implement in shell otherwise. * Other projects that use Meson could integrate liburing easily into their build system by using Meson's subproject() functionality. * Meson provides some useful editor/IDE integration, e.g. by generating compile_commands.json for clangd. * Distribution packagers are provided with a "standard" build system, with well known options/features/behavior, that is actively developed. Co-developed-by: Florian Fischer Signed-off-by: Peter Eszlari Signed-off-by: Florian Fischer --- .gitignore | 2 + examples/meson.build | 17 ++++ man/meson.build | 7 ++ meson.build | 133 ++++++++++++++++++++++++++++ meson_options.txt | 9 ++ src/include/liburing/compat.h.in | 7 ++ src/include/liburing/meson.build | 46 ++++++++++ src/include/meson.build | 3 + src/meson.build | 17 ++++ test/meson.build | 147 +++++++++++++++++++++++++++++++ 10 files changed, 388 insertions(+) create mode 100644 examples/meson.build create mode 100644 man/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 src/include/liburing/compat.h.in create mode 100644 src/include/liburing/meson.build create mode 100644 src/include/meson.build create mode 100644 src/meson.build create mode 100644 test/meson.build diff --git a/.gitignore b/.gitignore index 6e8a2f7..40d3717 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,5 @@ config.log liburing.pc cscope.out + +/build/ diff --git a/examples/meson.build b/examples/meson.build new file mode 100644 index 0000000..becfc02 --- /dev/null +++ b/examples/meson.build @@ -0,0 +1,17 @@ +executable('io_uring-cp', + 'io_uring-cp.c', + dependencies: uring) + +executable('io_uring-test', + 'io_uring-test.c', + dependencies: uring) + +executable('link-cp', + 'link-cp.c', + dependencies: uring) + +if has_ucontext + executable('ucontext-cp', + 'ucontext-cp.c', + dependencies: uring) +endif diff --git a/man/meson.build b/man/meson.build new file mode 100644 index 0000000..94e44b3 --- /dev/null +++ b/man/meson.build @@ -0,0 +1,7 @@ +install_man('io_uring.7', + 'io_uring_enter.2', + 'io_uring_get_sqe.3', + 'io_uring_queue_exit.3', + 'io_uring_queue_init.3', + 'io_uring_register.2', + 'io_uring_setup.2') diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..cb7dd9e --- /dev/null +++ b/meson.build @@ -0,0 +1,133 @@ +project('liburing', ['c','cpp'], + version: run_command('awk', '/Version:/ { print $2 }', 'liburing.spec').stdout().strip(), + license: ['MIT', 'LGPL-2.1-only', 'GPL-2.0-only WITH Linux-syscall-note'], + meson_version: '>=0.53.0', + default_options: ['default_library=both', + 'buildtype=debugoptimized', + 'c_std=c11', + 'cpp_std=c++11', + 'warning_level=3']) + +add_project_arguments('-D_GNU_SOURCE', + '-D__SANE_USERSPACE_TYPES__', + '-include', meson.current_build_dir() + '/config-host.h', + '-Wno-unused-parameter', + '-Wno-sign-compare', + '-fomit-frame-pointer', + language: ['c', 'cpp']) + +thread_dep = dependency('threads') + +cc = meson.get_compiler('c') + +code = '''#include +int main(int argc, char **argv) +{ + __kernel_rwf_t x; + x = 0; + return x; +} +''' +has__kernel_rwf_t = cc.compiles(code, name : '__kernel_rwf_t') + +code = '''#include +#include +int main(int argc, char **argv) +{ + struct __kernel_timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = 1; + return 0; +} +''' +has__kernel_timespec = cc.compiles(code, name : '__kernel_timespec') + +code = '''#include +#include +#include +#include +int main(int argc, char **argv) +{ + struct open_how how; + how.flags = 0; + how.mode = 0; + how.resolve = 0; + return 0; +} +''' +has_open_how = cc.compiles(code, name: 'open_how') + +code = '''#include +#include +#include +#include +#include +#include +int main(int argc, char **argv) +{ + struct statx x; + + return memset(&x, 0, sizeof(x)) != NULL; +} +''' +has_statx = cc.compiles(code, name: 'statx') + +cpp = meson.get_compiler('cpp') + +code = '''#include +int main(int argc, char **argv) +{ + std::cout << "Test"; + return 0; +} +''' +has_cxx = cpp.compiles(code, name: 'C++') + +code = '''#include +int main(int argc, char **argv) +{ + ucontext_t ctx; + getcontext(&ctx); + return 0; +} +''' +has_ucontext = cc.compiles(code, name : 'ucontext') + +conf_data = configuration_data() +conf_data.set('CONFIG_HAVE_KERNEL_RWF_T', has__kernel_rwf_t) +conf_data.set('CONFIG_HAVE_KERNEL_TIMESPEC', has__kernel_timespec) +conf_data.set('CONFIG_HAVE_OPEN_HOW', has_open_how) +conf_data.set('CONFIG_HAVE_STATX', has_statx) +conf_data.set('CONFIG_HAVE_CXX', has_cxx) +conf_data.set('CONFIG_HAVE_UCONTEXT', has_ucontext) +configure_file(output: 'config-host.h', + configuration: conf_data) + +subdir('src') +subdir('man') + +if get_option('examples') + subdir('examples') +endif + +if get_option('tests') + if get_option('default_library') != 'both' + error('default_library=both required to build tests') + endif + subdir('test') +endif + +pkg_mod = import('pkgconfig') +pkg_mod.generate(libraries: liburing, + name: 'liburing', + version: meson.project_version(), + description: 'io_uring library', + url: 'http://git.kernel.dk/cgit/liburing/') + +summary({'bindir': get_option('bindir'), + 'libdir': get_option('libdir'), + 'datadir': get_option('datadir'), + }, section: 'Directories') +summary({'examples': get_option('examples'), + 'tests': get_option('tests') + }, section: 'Configuration', bool_yn: true) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..e9f581a --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,9 @@ +option('examples', + type : 'boolean', + value : false, + description : 'Build example programs') + +option('tests', + type : 'boolean', + value : false, + description : 'Build test programs') diff --git a/src/include/liburing/compat.h.in b/src/include/liburing/compat.h.in new file mode 100644 index 0000000..2e92907 --- /dev/null +++ b/src/include/liburing/compat.h.in @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: MIT */ +#ifndef LIBURING_COMPAT_H +#define LIBURING_COMPAT_H +@__kernel_rwf_t_compat@ +@__kernel_timespec_compat@ +@open_how_compat@ +#endif diff --git a/src/include/liburing/meson.build b/src/include/liburing/meson.build new file mode 100644 index 0000000..f60cbc7 --- /dev/null +++ b/src/include/liburing/meson.build @@ -0,0 +1,46 @@ +if has__kernel_rwf_t + __kernel_rwf_t_compat = '' +else + __kernel_rwf_t_compat = '''typedef int __kernel_rwf_t; +''' +endif + +if has__kernel_timespec + __kernel_timespec_compat = '''#include +''' +else + __kernel_timespec_compat = '''#include + +struct __kernel_timespec { + int64_t tv_sec; + long long tv_nsec; +}; +''' +endif + +if has_open_how + open_how_compat = '' +else + open_how_compat = '''#include + +struct open_how { + uint64_t flags; + uint64_t mode; + uint64_t resolve; +}; +''' +endif + +conf_data = configuration_data() +conf_data.set('__kernel_rwf_t_compat', __kernel_rwf_t_compat) +conf_data.set('__kernel_timespec_compat', __kernel_timespec_compat) +conf_data.set('open_how_compat', open_how_compat) +configure_file(input: 'compat.h.in', + output: 'compat.h', + configuration: conf_data, + install: true, + install_dir: get_option('includedir') / 'liburing') + +install_headers('barrier.h', + 'io_uring.h', + subdir: 'liburing') diff --git a/src/include/meson.build b/src/include/meson.build new file mode 100644 index 0000000..7d5ddf0 --- /dev/null +++ b/src/include/meson.build @@ -0,0 +1,3 @@ +install_headers('liburing.h') + +subdir('liburing') diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..b3aa751 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,17 @@ +subdir('include') + +inc = include_directories(['include']) + +liburing = library('uring', + 'queue.c', + 'register.c', + 'setup.c', + 'syscall.c', + include_directories: inc, + link_args: '-Wl,--version-script=' + meson.current_source_dir() + '/liburing.map', + link_depends: 'liburing.map', + version: meson.project_version(), + install: true) + +uring = declare_dependency(link_with: liburing, + include_directories: inc) diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 0000000..888b74d --- /dev/null +++ b/test/meson.build @@ -0,0 +1,147 @@ +all_tests = [['232c93d07b74-test', 'c', thread_dep], + ['35fa71a030ca-test', 'c', thread_dep], + ['500f9fbadef8-test', 'c', []], + ['7ad0e4b2f83c-test', 'c', []], + ['8a9973408177-test', 'c', []], + ['917257daa0fe-test', 'c', []], + ['a0908ae19763-test', 'c', []], + ['a4c0b3decb33-test', 'c', []], + ['accept', 'c', []], + ['accept-link', 'c', thread_dep], + ['accept-reuse', 'c', []], + ['accept-test', 'c', []], + ['across-fork', 'c', thread_dep], + ['splice', 'c', []], + ['b19062a56726-test', 'c', []], + ['b5837bd5311d-test', 'c', []], + ['ce593a6c480a-test', 'c', thread_dep], + ['close-opath', 'c', []], + ['connect', 'c', []], + ['cq-full', 'c', []], + ['cq-overflow', 'c', []], + ['cq-overflow-peek', 'c', []], + ['cq-peek-batch', 'c', []], + ['cq-ready', 'c', []], + ['cq-size', 'c', []], + ['d4ae271dfaae-test', 'c', []], + ['d77a67ed5f27-test', 'c', []], + ['defer', 'c', []], + ['double-poll-crash', 'c', []], + ['eeed8b54e0df-test', 'c', []], + ['eventfd', 'c', []], + ['eventfd-disable', 'c', []], + ['eventfd-ring', 'c', []], + ['fadvise', 'c', []], + ['fallocate', 'c', []], + ['fc2a85cb02ef-test', 'c', []], + ['file-register', 'c', []], + ['file-update', 'c', []], + ['files-exit-hang-poll', 'c', []], + ['files-exit-hang-timeout', 'c', []], + ['fixed-link', 'c', []], + ['fsync', 'c', []], + ['io-cancel', 'c', []], + ['io_uring_enter', 'c', []], + ['io_uring_register', 'c', []], + ['io_uring_setup', 'c', []], + ['iopoll', 'c', []], + ['lfs-openat', 'c', []], + ['lfs-openat-write', 'c', []], + ['link', 'c', []], + ['link-timeout', 'c', []], + ['link_drain', 'c', []], + ['madvise', 'c', []], + ['nop', 'c', []], + ['nop-all-sizes', 'c', []], + ['open-close', 'c', []], + ['openat2', 'c', []], + ['personality', 'c', []], + ['pipe-eof', 'c', thread_dep], + ['pipe-reuse', 'c', []], + ['poll', 'c', []], + ['poll-cancel', 'c', []], + ['poll-cancel-ton', 'c', []], + ['poll-link', 'c', thread_dep], + ['poll-many', 'c', []], + ['poll-ring', 'c', []], + ['poll-v-poll', 'c', thread_dep], + ['probe', 'c', []], + ['read-write', 'c', []], + ['register-restrictions', 'c', []], + ['rename', 'c', []], + ['ring-leak', 'c', []], + ['ring-leak2', 'c', thread_dep], + ['self', 'c', []], + ['send_recv', 'c', thread_dep], + ['send_recvmsg', 'c', thread_dep], + ['shared-wq', 'c', []], + ['short-read', 'c', []], + ['shutdown', 'c', []], + ['sigfd-deadlock', 'c', []], + ['socket-rw', 'c', []], + ['socket-rw-eagain', 'c', []], + ['sq-full', 'c', []], + ['sq-poll-dup', 'c', []], + ['sq-poll-kthread', 'c', []], + ['sq-poll-share', 'c', []], + ['sqpoll-exit-hang', 'c', []], + ['sqpoll-sleep', 'c', []], + ['sq-space_left', 'c', []], + ['stdout', 'c', []], + ['submit-reuse', 'c', thread_dep], + ['teardowns', 'c', []], + ['thread-exit', 'c', thread_dep], + ['timeout', 'c', []], + ['timeout-new', 'c', thread_dep], + ['timeout-overflow', 'c', []], + ['unlink', 'c', []], + ['wakeup-hang', 'c', thread_dep]] + +if has_statx + all_tests += [['statx', 'c', []]] +endif + +if has_cxx + all_tests += [['sq-full-cpp', 'cc', []]] +endif + +runtests_sh = find_program('runtests.sh') +runtests_loop_sh = find_program('runtests-loop.sh') + +foreach t : all_tests + executable(t[0], + t[0] + '.' + t[1], + include_directories: inc, + link_with: liburing.get_static_lib(), + dependencies: t[2], + install: true, + install_dir: get_option('datadir') / 'liburing-test') + + test(t[0], + runtests_sh, + args: t[0], + workdir : meson.current_build_dir(), + suite: 'once') + + test(t[0] + '_loop', + runtests_loop_sh, + args: t[0], + workdir: meson.current_build_dir(), + suite: 'loop') +endforeach + +configure_file(input: 'runtests.sh', + output: 'runtests.sh', + copy: true) + +configure_file(input: 'runtests-loop.sh', + output: 'runtests-loop.sh', + copy: true) + +configure_file(input: 'config', + output: 'config.local', + copy: true) + +install_data('runtests.sh', + 'runtests-loop.sh', + install_dir: get_option('datadir') / 'liburing-test') From patchwork Wed Jul 27 15:27:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Florian Fischer X-Patchwork-Id: 12930480 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53C63C19F2B for ; Wed, 27 Jul 2022 15:34:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232127AbiG0PeX (ORCPT ); Wed, 27 Jul 2022 11:34:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233553AbiG0PeW (ORCPT ); Wed, 27 Jul 2022 11:34:22 -0400 Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 456EC1F61F for ; Wed, 27 Jul 2022 08:34:21 -0700 (PDT) Received: (qmail 15032 invoked by uid 989); 27 Jul 2022 15:27:38 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) From: Florian Fischer To: io-uring@vger.kernel.org Cc: Florian Schmaus , Florian Fischer Subject: [PATCH liburing 2/9] meson: update meson build files for liburing 2.3 Date: Wed, 27 Jul 2022 17:27:16 +0200 Message-Id: <20220727152723.3320169-3-florian.fischer@muhq.space> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727152723.3320169-1-florian.fischer@muhq.space> References: <20220727152723.3320169-1-florian.fischer@muhq.space> MIME-Version: 1.0 X-Rspamd-Bar: ------ X-Rspamd-Report: MIME_GOOD(-0.1) REPLY(-4) MID_CONTAINS_FROM(1) BAYES_HAM(-2.996886) X-Rspamd-Score: -6.096886 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Wed, 27 Jul 2022 17:27:38 +0200 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org * meson has builtin methods to check if the used compiler supports certain types and their expected members. Therefore we don't need to check if code using those types compiles. This makes the build file more readable. Suggested-By: Nils Tonnätt * do not use -Wpedantic like the custom build system * check if ucontext functions are available. See: b5f2347 * add explicit run_command check kwarg The default will change in future meson versions causing possible unexpected behavior. And the awk command should not fail in the first place. * set -DLIBURING_INTERNAL introduced in 8be8af4a * include linux/openat2.h for struct open_how. See: 326ed975 * check if glibc provides struct statx. See: 44b12f5 * use -O3 as default. See: 7d1cce2 * update project CFLAGS. Remove -fomit-frame-pointer (de21479) and add -fno-stack-protector (2de9832). Reported-by: Eli Schwartz Signed-off-by: Florian Fischer --- meson.build | 81 ++++++++++++-------------------- src/include/liburing/meson.build | 7 ++- src/meson.build | 1 + test/meson.build | 2 +- 4 files changed, 37 insertions(+), 54 deletions(-) diff --git a/meson.build b/meson.build index cb7dd9e..7c91b97 100644 --- a/meson.build +++ b/meson.build @@ -1,103 +1,80 @@ project('liburing', ['c','cpp'], - version: run_command('awk', '/Version:/ { print $2 }', 'liburing.spec').stdout().strip(), + version: run_command('awk', '/Version:/ { print $2 }', 'liburing.spec', check: true).stdout().strip(), license: ['MIT', 'LGPL-2.1-only', 'GPL-2.0-only WITH Linux-syscall-note'], meson_version: '>=0.53.0', default_options: ['default_library=both', 'buildtype=debugoptimized', 'c_std=c11', 'cpp_std=c++11', - 'warning_level=3']) + 'optimization=3', + 'warning_level=2']) add_project_arguments('-D_GNU_SOURCE', '-D__SANE_USERSPACE_TYPES__', '-include', meson.current_build_dir() + '/config-host.h', '-Wno-unused-parameter', '-Wno-sign-compare', - '-fomit-frame-pointer', language: ['c', 'cpp']) thread_dep = dependency('threads') cc = meson.get_compiler('c') -code = '''#include -int main(int argc, char **argv) -{ - __kernel_rwf_t x; - x = 0; - return x; -} -''' -has__kernel_rwf_t = cc.compiles(code, name : '__kernel_rwf_t') +has__kernel_rwf_t = cc.has_type('__kernel_rwf_t', prefix: '#include ') -code = '''#include -#include -int main(int argc, char **argv) -{ - struct __kernel_timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 1; - return 0; -} -''' -has__kernel_timespec = cc.compiles(code, name : '__kernel_timespec') +has__kernel_timespec = cc.has_members('struct __kernel_timespec', + 'tv_sec', + 'tv_nsec', + prefix: '#include ') + +has_open_how = cc.has_members('struct open_how', + 'flags', + 'mode', + 'resolve', + prefix: '#include ') code = '''#include #include +#include #include #include +#include int main(int argc, char **argv) { - struct open_how how; - how.flags = 0; - how.mode = 0; - how.resolve = 0; - return 0; + struct statx x; + + return memset(&x, 0, sizeof(x)) != NULL; } ''' -has_open_how = cc.compiles(code, name: 'open_how') +has_statx = cc.compiles(code, name: 'statx') -code = '''#include -#include +code= '''#include #include #include #include #include -int main(int argc, char **argv) +main(int argc, char **argv) { struct statx x; return memset(&x, 0, sizeof(x)) != NULL; } ''' -has_statx = cc.compiles(code, name: 'statx') - -cpp = meson.get_compiler('cpp') +glibc_statx = cc.compiles(code, name: 'glibc_statx') -code = '''#include -int main(int argc, char **argv) -{ - std::cout << "Test"; - return 0; -} -''' -has_cxx = cpp.compiles(code, name: 'C++') +# Since the project is configured to use C++ +# meson fails if no C++ compiler is available. +has_cxx = true -code = '''#include -int main(int argc, char **argv) -{ - ucontext_t ctx; - getcontext(&ctx); - return 0; -} -''' -has_ucontext = cc.compiles(code, name : 'ucontext') +has_ucontext = (cc.has_type('ucontext_t', prefix: '#include ') + and cc.has_function('makecontext', prefix: '#include ')) conf_data = configuration_data() conf_data.set('CONFIG_HAVE_KERNEL_RWF_T', has__kernel_rwf_t) conf_data.set('CONFIG_HAVE_KERNEL_TIMESPEC', has__kernel_timespec) conf_data.set('CONFIG_HAVE_OPEN_HOW', has_open_how) conf_data.set('CONFIG_HAVE_STATX', has_statx) +conf_data.set('CONFIG_HAVE_GLIBC_STATX', glibc_statx) conf_data.set('CONFIG_HAVE_CXX', has_cxx) conf_data.set('CONFIG_HAVE_UCONTEXT', has_ucontext) configure_file(output: 'config-host.h', diff --git a/src/include/liburing/meson.build b/src/include/liburing/meson.build index f60cbc7..ed5c65b 100644 --- a/src/include/liburing/meson.build +++ b/src/include/liburing/meson.build @@ -19,7 +19,7 @@ struct __kernel_timespec { endif if has_open_how - open_how_compat = '' + open_how_compat = '#include ' else open_how_compat = '''#include @@ -35,6 +35,11 @@ conf_data = configuration_data() conf_data.set('__kernel_rwf_t_compat', __kernel_rwf_t_compat) conf_data.set('__kernel_timespec_compat', __kernel_timespec_compat) conf_data.set('open_how_compat', open_how_compat) + +if not glibc_statx and has_statx + conf_data.set('no_glibc_statx', '#include ') +endif + configure_file(input: 'compat.h.in', output: 'compat.h', configuration: conf_data, diff --git a/src/meson.build b/src/meson.build index b3aa751..fad0fca 100644 --- a/src/meson.build +++ b/src/meson.build @@ -8,6 +8,7 @@ liburing = library('uring', 'setup.c', 'syscall.c', include_directories: inc, + c_args: ['-DLIBURING_INTERNAL', '-fno-stack-protector'], link_args: '-Wl,--version-script=' + meson.current_source_dir() + '/liburing.map', link_depends: 'liburing.map', version: meson.project_version(), diff --git a/test/meson.build b/test/meson.build index 888b74d..60b50c2 100644 --- a/test/meson.build +++ b/test/meson.build @@ -97,7 +97,7 @@ all_tests = [['232c93d07b74-test', 'c', thread_dep], ['unlink', 'c', []], ['wakeup-hang', 'c', thread_dep]] -if has_statx +if has_statx or glibc_statx all_tests += [['statx', 'c', []]] endif From patchwork Wed Jul 27 15:27:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fischer X-Patchwork-Id: 12930483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77C92C19F2B for ; Wed, 27 Jul 2022 15:34:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233215AbiG0Pe2 (ORCPT ); Wed, 27 Jul 2022 11:34:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232684AbiG0Pe1 (ORCPT ); Wed, 27 Jul 2022 11:34:27 -0400 Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50C3024963 for ; Wed, 27 Jul 2022 08:34:26 -0700 (PDT) Received: (qmail 15095 invoked by uid 989); 27 Jul 2022 15:27:43 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) From: Florian Fischer To: io-uring@vger.kernel.org Cc: Florian Schmaus , Florian Fischer Subject: [PATCH liburing 3/9] meson: update available tests to liburing 2.3 Date: Wed, 27 Jul 2022 17:27:17 +0200 Message-Id: <20220727152723.3320169-4-florian.fischer@muhq.space> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727152723.3320169-1-florian.fischer@muhq.space> References: <20220727152723.3320169-1-florian.fischer@muhq.space> MIME-Version: 1.0 X-Rspamd-Bar: -- X-Rspamd-Report: R_MISSING_CHARSET(0.5) MIME_GOOD(-0.1) REPLY(-4) MID_CONTAINS_FROM(1) BAYES_HAM(-0.000002) X-Rspamd-Score: -2.600002 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Wed, 27 Jul 2022 17:27:43 +0200 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org * Update the available tests. * Check for -Warray-bound and -Wstringop-overflow and use them if available. Include test/helper.c when building the test executables. * Bump required meson version from 0.53 to 0.54 to use fs.stem. * Simplify the meson test definition code by using a plain list of source files instead of the complex list of lists. Obtain the test name by stripping the file suffix from the test source using the meson fs module. * Link each test with the thread dependency similar to: 664bf78. * Run tests sequentially to prevent dmesg log intermixing expected by the test tooling. Suggested-by: Eli Schwartz * Add a 'parallel' test suite to mirror make test-parallel. Signed-off-by: Florian Fischer --- meson.build | 3 + test/meson.build | 306 ++++++++++++++++++++++++++++------------------- 2 files changed, 187 insertions(+), 122 deletions(-) diff --git a/meson.build b/meson.build index 7c91b97..0a63fef 100644 --- a/meson.build +++ b/meson.build @@ -20,6 +20,9 @@ thread_dep = dependency('threads') cc = meson.get_compiler('c') +has_stringop_overflow = cc.has_argument('-Wstringop-overflow=0') +has_array_bounds = cc.has_argument('-Warray-bounds=0') + has__kernel_rwf_t = cc.has_type('__kernel_rwf_t', prefix: '#include ') has__kernel_timespec = cc.has_members('struct __kernel_timespec', diff --git a/test/meson.build b/test/meson.build index 60b50c2..4d9b3f3 100644 --- a/test/meson.build +++ b/test/meson.build @@ -1,147 +1,209 @@ -all_tests = [['232c93d07b74-test', 'c', thread_dep], - ['35fa71a030ca-test', 'c', thread_dep], - ['500f9fbadef8-test', 'c', []], - ['7ad0e4b2f83c-test', 'c', []], - ['8a9973408177-test', 'c', []], - ['917257daa0fe-test', 'c', []], - ['a0908ae19763-test', 'c', []], - ['a4c0b3decb33-test', 'c', []], - ['accept', 'c', []], - ['accept-link', 'c', thread_dep], - ['accept-reuse', 'c', []], - ['accept-test', 'c', []], - ['across-fork', 'c', thread_dep], - ['splice', 'c', []], - ['b19062a56726-test', 'c', []], - ['b5837bd5311d-test', 'c', []], - ['ce593a6c480a-test', 'c', thread_dep], - ['close-opath', 'c', []], - ['connect', 'c', []], - ['cq-full', 'c', []], - ['cq-overflow', 'c', []], - ['cq-overflow-peek', 'c', []], - ['cq-peek-batch', 'c', []], - ['cq-ready', 'c', []], - ['cq-size', 'c', []], - ['d4ae271dfaae-test', 'c', []], - ['d77a67ed5f27-test', 'c', []], - ['defer', 'c', []], - ['double-poll-crash', 'c', []], - ['eeed8b54e0df-test', 'c', []], - ['eventfd', 'c', []], - ['eventfd-disable', 'c', []], - ['eventfd-ring', 'c', []], - ['fadvise', 'c', []], - ['fallocate', 'c', []], - ['fc2a85cb02ef-test', 'c', []], - ['file-register', 'c', []], - ['file-update', 'c', []], - ['files-exit-hang-poll', 'c', []], - ['files-exit-hang-timeout', 'c', []], - ['fixed-link', 'c', []], - ['fsync', 'c', []], - ['io-cancel', 'c', []], - ['io_uring_enter', 'c', []], - ['io_uring_register', 'c', []], - ['io_uring_setup', 'c', []], - ['iopoll', 'c', []], - ['lfs-openat', 'c', []], - ['lfs-openat-write', 'c', []], - ['link', 'c', []], - ['link-timeout', 'c', []], - ['link_drain', 'c', []], - ['madvise', 'c', []], - ['nop', 'c', []], - ['nop-all-sizes', 'c', []], - ['open-close', 'c', []], - ['openat2', 'c', []], - ['personality', 'c', []], - ['pipe-eof', 'c', thread_dep], - ['pipe-reuse', 'c', []], - ['poll', 'c', []], - ['poll-cancel', 'c', []], - ['poll-cancel-ton', 'c', []], - ['poll-link', 'c', thread_dep], - ['poll-many', 'c', []], - ['poll-ring', 'c', []], - ['poll-v-poll', 'c', thread_dep], - ['probe', 'c', []], - ['read-write', 'c', []], - ['register-restrictions', 'c', []], - ['rename', 'c', []], - ['ring-leak', 'c', []], - ['ring-leak2', 'c', thread_dep], - ['self', 'c', []], - ['send_recv', 'c', thread_dep], - ['send_recvmsg', 'c', thread_dep], - ['shared-wq', 'c', []], - ['short-read', 'c', []], - ['shutdown', 'c', []], - ['sigfd-deadlock', 'c', []], - ['socket-rw', 'c', []], - ['socket-rw-eagain', 'c', []], - ['sq-full', 'c', []], - ['sq-poll-dup', 'c', []], - ['sq-poll-kthread', 'c', []], - ['sq-poll-share', 'c', []], - ['sqpoll-exit-hang', 'c', []], - ['sqpoll-sleep', 'c', []], - ['sq-space_left', 'c', []], - ['stdout', 'c', []], - ['submit-reuse', 'c', thread_dep], - ['teardowns', 'c', []], - ['thread-exit', 'c', thread_dep], - ['timeout', 'c', []], - ['timeout-new', 'c', thread_dep], - ['timeout-overflow', 'c', []], - ['unlink', 'c', []], - ['wakeup-hang', 'c', thread_dep]] +all_tests = [ + '232c93d07b74.c', + '35fa71a030ca.c', + '500f9fbadef8.c', + '7ad0e4b2f83c.c', + '8a9973408177.c', + '917257daa0fe.c', + 'a0908ae19763.c', + 'a4c0b3decb33.c', + 'accept.c', + 'accept-link.c', + 'accept-reuse.c', + 'accept-test.c', + 'across-fork.c', + 'b19062a56726.c', + 'b5837bd5311d.c', + 'buf-ring.c', + 'ce593a6c480a.c', + 'close-opath.c', + 'connect.c', + 'cq-full.c', + 'cq-overflow.c', + 'cq-peek-batch.c', + 'cq-ready.c', + 'cq-size.c', + 'd4ae271dfaae.c', + 'd77a67ed5f27.c', + 'defer.c', + 'double-poll-crash.c', + 'drop-submit.c', + 'eeed8b54e0df.c', + 'empty-eownerdead.c', + 'eventfd.c', + 'eventfd-disable.c', + 'eventfd-reg.c', + 'eventfd-ring.c', + 'exec-target.c', + 'exit-no-cleanup.c', + 'fadvise.c', + 'fallocate.c', + 'fc2a85cb02ef.c', + 'fd-pass.c', + 'file-register.c', + 'files-exit-hang-poll.c', + 'files-exit-hang-timeout.c', + 'file-update.c', + 'file-verify.c', + 'fixed-buf-iter.c', + 'fixed-link.c', + 'fixed-reuse.c', + 'fpos.c', + 'fsync.c', + 'hardlink.c', + 'io-cancel.c', + 'iopoll.c', + 'io_uring_enter.c', + 'io_uring_register.c', + 'io_uring_setup.c', + 'lfs-openat.c', + 'lfs-openat-write.c', + 'link.c', + 'link_drain.c', + 'link-timeout.c', + 'madvise.c', + 'mkdir.c', + 'msg-ring.c', + 'multicqes_drain.c', + 'nolibc.c', + 'nop-all-sizes.c', + 'nop.c', + 'openat2.c', + 'open-close.c', + 'open-direct-link.c', + 'open-direct-pick.c', + 'personality.c', + 'pipe-eof.c', + 'pipe-reuse.c', + 'poll.c', + 'poll-cancel.c', + 'poll-cancel-all.c', + 'poll-cancel-ton.c', + 'poll-link.c', + 'poll-many.c', + 'poll-mshot-overflow.c', + 'poll-mshot-update.c', + 'poll-ring.c', + 'poll-v-poll.c', + 'pollfree.c', + 'probe.c', + 'read-before-exit.c', + 'read-write.c', + 'recv-msgall.c', + 'recv-msgall-stream.c', + 'recv-multishot.c', + 'register-restrictions.c', + 'rename.c', + 'ring-leak2.c', + 'ring-leak.c', + 'rsrc_tags.c', + 'rw_merge_test.c', + 'self.c', + 'send_recv.c', + 'sendmsg_fs_cve.c', + 'send_recvmsg.c', + 'send-zerocopy.c', + 'shared-wq.c', + 'short-read.c', + 'shutdown.c', + 'sigfd-deadlock.c', + 'single-issuer.c', + 'skip-cqe.c', + 'socket.c', + 'socket-rw.c', + 'socket-rw-eagain.c', + 'socket-rw-offset.c', + 'splice.c', + 'sq-full.c', + 'sqpoll-cancel-hang.c', + 'sqpoll-disable-exit.c', + 'sq-poll-dup.c', + 'sqpoll-exit-hang.c', + 'sq-poll-kthread.c', + 'sq-poll-share.c', + 'sqpoll-sleep.c', + 'sq-space_left.c', + 'stdout.c', + 'submit-link-fail.c', + 'submit-reuse.c', + 'symlink.c', + 'sync-cancel.c', + 'teardowns.c', + 'thread-exit.c', + 'timeout.c', + 'timeout-new.c', + 'timeout-overflow.c', + 'tty-write-dpoll.c', + 'unlink.c', + 'wakeup-hang.c', + 'xattr.c', +] if has_statx or glibc_statx - all_tests += [['statx', 'c', []]] + all_tests += ['statx.c'] endif if has_cxx - all_tests += [['sq-full-cpp', 'cc', []]] + all_tests += ['sq-full-cpp.cc'] endif runtests_sh = find_program('runtests.sh') runtests_loop_sh = find_program('runtests-loop.sh') +runtests_quiet_sh = find_program('runtests-quiet.sh') -foreach t : all_tests - executable(t[0], - t[0] + '.' + t[1], +xcflags = [] +if has_stringop_overflow + xcflags = xcflags + ['-Wstringop-overflow=0'] +endif +if has_array_bounds + xcflags = xcflags + ['-Warray-bounds=0'] +endif + +test_dependencies = [thread_dep] + +foreach test_source: all_tests + # Tests are not allowed to contain multiple '.' in their name + # using the meson filesystem module would solve this restriction + # but require to bump our minimum meson version to '>= 0.54'. + test_name = test_source.split()[0] + executable(test_name, + [test_source, 'helpers.c'], + c_args: xcflags, + cpp_args: xcflags, include_directories: inc, link_with: liburing.get_static_lib(), - dependencies: t[2], + dependencies: test_dependencies, install: true, install_dir: get_option('datadir') / 'liburing-test') - test(t[0], + test(test_name, runtests_sh, - args: t[0], - workdir : meson.current_build_dir(), + args: test_name, + is_parallel: false, + workdir: meson.current_build_dir(), suite: 'once') - test(t[0] + '_loop', + test(test_name + '_loop', runtests_loop_sh, - args: t[0], + args: test_name, + is_parallel: false, workdir: meson.current_build_dir(), suite: 'loop') -endforeach -configure_file(input: 'runtests.sh', - output: 'runtests.sh', - copy: true) + test(test_name + '_quiet', + runtests_quiet_sh, + args: test_name, + workdir: meson.current_build_dir(), + suite: 'parallel') +endforeach -configure_file(input: 'runtests-loop.sh', - output: 'runtests-loop.sh', - copy: true) +test_runners = ['runtests.sh', 'runtests-loop.sh', 'runtests-quiet.sh'] -configure_file(input: 'config', - output: 'config.local', - copy: true) +foreach test_runner: test_runners + configure_file(input: test_runner, + output: test_runner, + copy: true) -install_data('runtests.sh', - 'runtests-loop.sh', - install_dir: get_option('datadir') / 'liburing-test') + install_data(test_runner, + install_dir: get_option('datadir') / 'liburing-test') +endforeach From patchwork Wed Jul 27 15:27:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fischer X-Patchwork-Id: 12930482 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDE2EC04A68 for ; Wed, 27 Jul 2022 15:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233650AbiG0Pe2 (ORCPT ); Wed, 27 Jul 2022 11:34:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233215AbiG0Pe1 (ORCPT ); Wed, 27 Jul 2022 11:34:27 -0400 Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50CB22CE04 for ; Wed, 27 Jul 2022 08:34:26 -0700 (PDT) Received: (qmail 15140 invoked by uid 989); 27 Jul 2022 15:27:44 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) From: Florian Fischer To: io-uring@vger.kernel.org Cc: Florian Schmaus , Florian Fischer Subject: [PATCH liburing 4/9] meson: update installed manpages to liburing 2.3 Date: Wed, 27 Jul 2022 17:27:18 +0200 Message-Id: <20220727152723.3320169-5-florian.fischer@muhq.space> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727152723.3320169-1-florian.fischer@muhq.space> References: <20220727152723.3320169-1-florian.fischer@muhq.space> MIME-Version: 1.0 X-Rspamd-Bar: -- X-Rspamd-Report: BAYES_SPAM(0.001119) R_MISSING_CHARSET(0.5) MIME_GOOD(-0.1) REPLY(-4) MID_CONTAINS_FROM(1) X-Rspamd-Score: -2.59888 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Wed, 27 Jul 2022 17:27:44 +0200 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Signed-off-by: Florian Fischer --- man/meson.build | 123 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 116 insertions(+), 7 deletions(-) diff --git a/man/meson.build b/man/meson.build index 94e44b3..8f4ec7e 100644 --- a/man/meson.build +++ b/man/meson.build @@ -1,7 +1,116 @@ -install_man('io_uring.7', - 'io_uring_enter.2', - 'io_uring_get_sqe.3', - 'io_uring_queue_exit.3', - 'io_uring_queue_init.3', - 'io_uring_register.2', - 'io_uring_setup.2') +install_man( + 'io_uring.7', + 'io_uring_buf_ring_add.3', + 'io_uring_buf_ring_advance.3', + 'io_uring_buf_ring_cq_advance.3', + 'io_uring_buf_ring_init.3', + 'io_uring_buf_ring_mask.3', + 'io_uring_cq_advance.3', + 'io_uring_cqe_get_data.3', + 'io_uring_cqe_get_data64.3', + 'io_uring_cqe_seen.3', + 'io_uring_cq_ready.3', + 'io_uring_enter.2', + 'io_uring_free_probe.3', + 'io_uring_get_probe.3', + 'io_uring_get_sqe.3', + 'io_uring_opcode_supported.3', + 'io_uring_peek_cqe.3', + 'io_uring_prep_accept.3', + 'io_uring_prep_accept_direct.3', + 'io_uring_prep_cancel.3', + 'io_uring_prep_close.3', + 'io_uring_prep_close_direct.3', + 'io_uring_prep_connect.3', + 'io_uring_prep_fadvise.3', + 'io_uring_prep_fallocate.3', + 'io_uring_prep_files_update.3', + 'io_uring_prep_fsync.3', + 'io_uring_prep_link.3', + 'io_uring_prep_linkat.3', + 'io_uring_prep_madvise.3', + 'io_uring_prep_mkdir.3', + 'io_uring_prep_mkdirat.3', + 'io_uring_prep_msg_ring.3', + 'io_uring_prep_multishot_accept.3', + 'io_uring_prep_multishot_accept_direct.3', + 'io_uring_prep_openat2.3', + 'io_uring_prep_openat2_direct.3', + 'io_uring_prep_openat.3', + 'io_uring_prep_openat_direct.3', + 'io_uring_prep_poll_add.3', + 'io_uring_prep_poll_multishot.3', + 'io_uring_prep_poll_remove.3', + 'io_uring_prep_poll_update.3', + 'io_uring_prep_provide_buffers.3', + 'io_uring_prep_read.3', + 'io_uring_prep_read_fixed.3', + 'io_uring_prep_readv2.3', + 'io_uring_prep_readv.3', + 'io_uring_prep_recv.3', + 'io_uring_prep_recv_multishot.3', + 'io_uring_prep_recvmsg.3', + 'io_uring_prep_recvmsg_multishot.3', + 'io_uring_prep_remove_buffers.3', + 'io_uring_prep_rename.3', + 'io_uring_prep_renameat.3', + 'io_uring_prep_send.3', + 'io_uring_prep_sendmsg.3', + 'io_uring_prep_shutdown.3', + 'io_uring_prep_socket.3', + 'io_uring_prep_socket_direct.3', + 'io_uring_prep_splice.3', + 'io_uring_prep_statx.3', + 'io_uring_prep_symlink.3', + 'io_uring_prep_symlinkat.3', + 'io_uring_prep_sync_file_range.3', + 'io_uring_prep_tee.3', + 'io_uring_prep_timeout.3', + 'io_uring_prep_timeout_remove.3', + 'io_uring_prep_timeout_update.3', + 'io_uring_prep_unlink.3', + 'io_uring_prep_unlinkat.3', + 'io_uring_prep_write.3', + 'io_uring_prep_write_fixed.3', + 'io_uring_prep_writev2.3', + 'io_uring_prep_writev.3', + 'io_uring_queue_exit.3', + 'io_uring_queue_init.3', + 'io_uring_queue_init_params.3', + 'io_uring_recvmsg_cmsg_firsthdr.3', + 'io_uring_recvmsg_cmsg_nexthdr.3', + 'io_uring_recvmsg_name.3', + 'io_uring_recvmsg_out.3', + 'io_uring_recvmsg_payload.3', + 'io_uring_recvmsg_payload_length.3', + 'io_uring_recvmsg_validate.3', + 'io_uring_register.2', + 'io_uring_register_buffers.3', + 'io_uring_register_buf_ring.3', + 'io_uring_register_eventfd.3', + 'io_uring_register_eventfd_async.3', + 'io_uring_register_files.3', + 'io_uring_register_iowq_aff.3', + 'io_uring_register_iowq_max_workers.3', + 'io_uring_register_ring_fd.3', + 'io_uring_setup.2', + 'io_uring_sqe_set_data.3', + 'io_uring_sqe_set_data64.3', + 'io_uring_sqe_set_flags.3', + 'io_uring_sq_ready.3', + 'io_uring_sqring_wait.3', + 'io_uring_sq_space_left.3', + 'io_uring_submit.3', + 'io_uring_submit_and_wait.3', + 'io_uring_submit_and_wait_timeout.3', + 'io_uring_unregister_buffers.3', + 'io_uring_unregister_buf_ring.3', + 'io_uring_unregister_eventfd.3', + 'io_uring_unregister_files.3', + 'io_uring_unregister_iowq_aff.3', + 'io_uring_unregister_ring_fd.3', + 'io_uring_wait_cqe.3', + 'io_uring_wait_cqe_nr.3', + 'io_uring_wait_cqes.3', + 'io_uring_wait_cqe_timeout.3', +) From patchwork Wed Jul 27 15:27:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fischer X-Patchwork-Id: 12930484 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 279CFC04A68 for ; Wed, 27 Jul 2022 15:34:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233855AbiG0Pea (ORCPT ); Wed, 27 Jul 2022 11:34:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232684AbiG0Pe3 (ORCPT ); Wed, 27 Jul 2022 11:34:29 -0400 Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5529C237D9 for ; Wed, 27 Jul 2022 08:34:28 -0700 (PDT) Received: (qmail 15183 invoked by uid 989); 27 Jul 2022 15:27:45 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) From: Florian Fischer To: io-uring@vger.kernel.org Cc: Florian Schmaus , Florian Fischer , Eli Schwartz Subject: [PATCH liburing 5/9] meson: add default test setup running each test once Date: Wed, 27 Jul 2022 17:27:19 +0200 Message-Id: <20220727152723.3320169-6-florian.fischer@muhq.space> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727152723.3320169-1-florian.fischer@muhq.space> References: <20220727152723.3320169-1-florian.fischer@muhq.space> MIME-Version: 1.0 X-Rspamd-Bar: ----- X-Rspamd-Report: R_MISSING_CHARSET(0.5) MIME_GOOD(-0.1) REPLY(-4) MID_CONTAINS_FROM(1) BAYES_HAM(-2.997468) X-Rspamd-Score: -5.597468 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Wed, 27 Jul 2022 17:27:45 +0200 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org With this patch running `meson test` in the build directory behaves like `make -C test runtests`. To execute the other test suites (running the tests in a loop or in parallel) run: `meson test --suite=loop` or `meson test --suite=parallel`. Suggested-by: Eli Schwartz Signed-off-by: Florian Fischer --- test/meson.build | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/meson.build b/test/meson.build index 4d9b3f3..af394a4 100644 --- a/test/meson.build +++ b/test/meson.build @@ -197,6 +197,12 @@ foreach test_source: all_tests suite: 'parallel') endforeach +if meson.version().version_compare('>=0.57') + add_test_setup('runtests', + exclude_suites: ['loop', 'parallel'], + is_default: true) +endif + test_runners = ['runtests.sh', 'runtests-loop.sh', 'runtests-quiet.sh'] foreach test_runner: test_runners From patchwork Wed Jul 27 15:27:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fischer X-Patchwork-Id: 12930485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3F41C19F28 for ; Wed, 27 Jul 2022 15:34:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233835AbiG0Peb (ORCPT ); Wed, 27 Jul 2022 11:34:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233882AbiG0Pea (ORCPT ); Wed, 27 Jul 2022 11:34:30 -0400 Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD9B324963 for ; Wed, 27 Jul 2022 08:34:28 -0700 (PDT) Received: (qmail 15226 invoked by uid 989); 27 Jul 2022 15:27:46 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) From: Florian Fischer To: io-uring@vger.kernel.org Cc: Florian Schmaus , Florian Fischer Subject: [PATCH liburing 6/9] meson: support building without libc Date: Wed, 27 Jul 2022 17:27:20 +0200 Message-Id: <20220727152723.3320169-7-florian.fischer@muhq.space> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727152723.3320169-1-florian.fischer@muhq.space> References: <20220727152723.3320169-1-florian.fischer@muhq.space> MIME-Version: 1.0 X-Rspamd-Bar: ----- X-Rspamd-Report: R_MISSING_CHARSET(0.5) MIME_GOOD(-0.1) REPLY(-4) MID_CONTAINS_FROM(1) BAYES_HAM(-2.999999) X-Rspamd-Score: -5.599999 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Wed, 27 Jul 2022 17:27:45 +0200 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Introduce a new meson option 'nolibc'. Include the headers in src/arch when building liburing. Build the src/syscall.c as seperate library for the tests when building without libc. Signed-off-by: Florian Fischer --- meson.build | 8 +++++++- meson_options.txt | 5 +++++ src/meson.build | 28 +++++++++++++++++++--------- test/meson.build | 2 +- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/meson.build b/meson.build index 0a63fef..e88e060 100644 --- a/meson.build +++ b/meson.build @@ -72,6 +72,10 @@ has_cxx = true has_ucontext = (cc.has_type('ucontext_t', prefix: '#include ') and cc.has_function('makecontext', prefix: '#include ')) +nolibc = get_option('nolibc') + +build_tests = get_option('tests') + conf_data = configuration_data() conf_data.set('CONFIG_HAVE_KERNEL_RWF_T', has__kernel_rwf_t) conf_data.set('CONFIG_HAVE_KERNEL_TIMESPEC', has__kernel_timespec) @@ -80,6 +84,8 @@ conf_data.set('CONFIG_HAVE_STATX', has_statx) conf_data.set('CONFIG_HAVE_GLIBC_STATX', glibc_statx) conf_data.set('CONFIG_HAVE_CXX', has_cxx) conf_data.set('CONFIG_HAVE_UCONTEXT', has_ucontext) +conf_data.set('CONFIG_NOLIBC', nolibc) +conf_data.set('LIBURING_BUILD_TEST', build_tests) configure_file(output: 'config-host.h', configuration: conf_data) @@ -90,7 +96,7 @@ if get_option('examples') subdir('examples') endif -if get_option('tests') +if build_tests if get_option('default_library') != 'both' error('default_library=both required to build tests') endif diff --git a/meson_options.txt b/meson_options.txt index e9f581a..5579b39 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -7,3 +7,8 @@ option('tests', type : 'boolean', value : false, description : 'Build test programs') + +option('nolibc', + type : 'boolean', + value : false, + description : 'Build liburing without libc') diff --git a/src/meson.build b/src/meson.build index fad0fca..8dd8139 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,18 +1,28 @@ subdir('include') -inc = include_directories(['include']) +liburing_includes = include_directories(['include']) +liburing_internal_includes = [liburing_includes] + +liburing_sources = ['queue.c', 'register.c', 'setup.c'] +liburing_c_args = ['-DLIBURING_INTERNAL', '-fno-stack-protector'] +liburing_link_args = ['-Wl,--version-script=' + meson.current_source_dir() + '/liburing.map'] + +if nolibc + liburing_internal_includes += include_directories(['arch']) + + liburing_sources += ['nolibc.c'] + liburing_c_args += ['-nostdlib', '-nodefaultlibs', '-ffreestanding'] + liburing_link_args += ['-nostdlib', '-nodefaultlibs'] +endif liburing = library('uring', - 'queue.c', - 'register.c', - 'setup.c', - 'syscall.c', - include_directories: inc, - c_args: ['-DLIBURING_INTERNAL', '-fno-stack-protector'], - link_args: '-Wl,--version-script=' + meson.current_source_dir() + '/liburing.map', + liburing_sources, + include_directories: liburing_internal_includes, + c_args: liburing_c_args, + link_args: liburing_link_args, link_depends: 'liburing.map', version: meson.project_version(), install: true) uring = declare_dependency(link_with: liburing, - include_directories: inc) + include_directories: liburing_includes) diff --git a/test/meson.build b/test/meson.build index af394a4..1537ad9 100644 --- a/test/meson.build +++ b/test/meson.build @@ -170,7 +170,7 @@ foreach test_source: all_tests [test_source, 'helpers.c'], c_args: xcflags, cpp_args: xcflags, - include_directories: inc, + include_directories: liburing_internal_includes, link_with: liburing.get_static_lib(), dependencies: test_dependencies, install: true, From patchwork Wed Jul 27 15:27:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fischer X-Patchwork-Id: 12930486 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A642C04A68 for ; Wed, 27 Jul 2022 15:34:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233882AbiG0Ped (ORCPT ); Wed, 27 Jul 2022 11:34:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233858AbiG0Pea (ORCPT ); Wed, 27 Jul 2022 11:34:30 -0400 Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD8FB1F61F for ; Wed, 27 Jul 2022 08:34:28 -0700 (PDT) Received: (qmail 15274 invoked by uid 989); 27 Jul 2022 15:27:46 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) From: Florian Fischer To: io-uring@vger.kernel.org Cc: Florian Schmaus , Florian Fischer Subject: [PATCH liburing 7/9] meson: add 'raw' test suite Date: Wed, 27 Jul 2022 17:27:21 +0200 Message-Id: <20220727152723.3320169-8-florian.fischer@muhq.space> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727152723.3320169-1-florian.fischer@muhq.space> References: <20220727152723.3320169-1-florian.fischer@muhq.space> MIME-Version: 1.0 X-Rspamd-Bar: ----- X-Rspamd-Report: R_MISSING_CHARSET(0.5) MIME_GOOD(-0.1) REPLY(-4) MID_CONTAINS_FROM(1) BAYES_HAM(-2.999422) X-Rspamd-Score: -5.599422 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Wed, 27 Jul 2022 17:27:46 +0200 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org The 'raw' test suite runs each compiled test without the runtest*.sh wrapper scripts. This is useful to debug tests using meson's gdb support. To debug a test in gdb run `meson test -C build --suite=raw _raw` Signed-off-by: Florian Fischer --- test/meson.build | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/test/meson.build b/test/meson.build index 1537ad9..088b5fa 100644 --- a/test/meson.build +++ b/test/meson.build @@ -166,15 +166,15 @@ foreach test_source: all_tests # using the meson filesystem module would solve this restriction # but require to bump our minimum meson version to '>= 0.54'. test_name = test_source.split()[0] - executable(test_name, - [test_source, 'helpers.c'], - c_args: xcflags, - cpp_args: xcflags, - include_directories: liburing_internal_includes, - link_with: liburing.get_static_lib(), - dependencies: test_dependencies, - install: true, - install_dir: get_option('datadir') / 'liburing-test') + test_exe = executable(test_name, + [test_source, 'helpers.c'], + c_args: xcflags, + cpp_args: xcflags, + include_directories: liburing_internal_includes, + link_with: liburing.get_static_lib(), + dependencies: test_dependencies, + install: true, + install_dir: get_option('datadir') / 'liburing-test') test(test_name, runtests_sh, @@ -195,6 +195,10 @@ foreach test_source: all_tests args: test_name, workdir: meson.current_build_dir(), suite: 'parallel') + + test(test_name + '_raw', + test_exe, + suite: 'raw') endforeach if meson.version().version_compare('>=0.57') From patchwork Wed Jul 27 15:27:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fischer X-Patchwork-Id: 12930487 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC8CAC19F2C for ; Wed, 27 Jul 2022 15:34:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232684AbiG0Ped (ORCPT ); Wed, 27 Jul 2022 11:34:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233864AbiG0Pea (ORCPT ); Wed, 27 Jul 2022 11:34:30 -0400 Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAB103D58A for ; Wed, 27 Jul 2022 08:34:28 -0700 (PDT) Received: (qmail 15316 invoked by uid 989); 27 Jul 2022 15:27:47 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) From: Florian Fischer To: io-uring@vger.kernel.org Cc: Florian Schmaus , Florian Fischer , Ammar Faizi Subject: [PATCH liburing 8/9] github bot: add jobs for meson Date: Wed, 27 Jul 2022 17:27:22 +0200 Message-Id: <20220727152723.3320169-9-florian.fischer@muhq.space> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727152723.3320169-1-florian.fischer@muhq.space> References: <20220727152723.3320169-1-florian.fischer@muhq.space> MIME-Version: 1.0 X-Rspamd-Bar: ----- X-Rspamd-Report: R_MISSING_CHARSET(0.5) MIME_GOOD(-0.1) REPLY(-4) MID_CONTAINS_FROM(1) BAYES_HAM(-2.876435) X-Rspamd-Score: -5.476435 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Wed, 27 Jul 2022 17:27:47 +0200 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org * Use meson CPU family names in matrix * Install meson and ninja * Create a cross compilation file * Build with meson * Build nolibc variant with meson * Test installation with meson Acked-by: Ammar Faizi Signed-off-by: Florian Fischer --- .github/workflows/build.yml | 45 +++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 333929c..95fd892 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: cxx: clang++ # x86 (32-bit) gcc - - arch: i686 + - arch: x86 cc_pkg: gcc-i686-linux-gnu cxx_pkg: g++-i686-linux-gnu cc: i686-linux-gnu-gcc @@ -49,14 +49,14 @@ jobs: cxx: arm-linux-gnueabi-g++ # powerpc64 - - arch: powerpc64 + - arch: ppc64 cc_pkg: gcc-powerpc64-linux-gnu cxx_pkg: g++-powerpc64-linux-gnu cc: powerpc64-linux-gnu-gcc cxx: powerpc64-linux-gnu-g++ # powerpc - - arch: powerpc + - arch: ppc cc_pkg: gcc-powerpc-linux-gnu cxx_pkg: g++-powerpc-linux-gnu cc: powerpc-linux-gnu-gcc @@ -85,6 +85,8 @@ jobs: env: FLAGS: -g -O3 -Wall -Wextra -Werror + MESON_BUILDDIR: build + MESON_CROSS_FILE: /tmp/cross-env.txt steps: - name: Checkout source @@ -114,7 +116,7 @@ jobs: - name: Build nolibc run: | - if [[ "${{matrix.arch}}" == "x86_64" || "${{matrix.arch}}" == "i686" || "${{matrix.arch}}" == "aarch64" ]]; then \ + if [[ "${{matrix.arch}}" == "x86_64" || "${{matrix.arch}}" == "x86" || "${{matrix.arch}}" == "aarch64" ]]; then \ make clean; \ ./configure --cc=${{matrix.cc}} --cxx=${{matrix.cxx}} --nolibc; \ make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS"; \ @@ -125,3 +127,38 @@ jobs: - name: Test install command run: | sudo make install; + + - name: Install meson + run: | + sudo apt-get update -y; + sudo apt-get install -y meson; + + - name: Generate meson cross file + run: | + { \ + echo -e "[host_machine]\nsystem = 'linux'"; \ + echo "cpu_family = '${{matrix.arch}}'"; \ + echo "cpu = '${{matrix.arch}}'"; \ + echo "endian = 'big'"; \ + echo -e "[binaries]\nc = '/usr/bin/${{matrix.cc}}'"; \ + echo "cpp = '/usr/bin/${{matrix.cxx}}'"; \ + } > "$MESON_CROSS_FILE" + + - name: Build with meson + run: | + meson setup "$MESON_BUILDDIR" -Dtests=true -Dexamples=true --cross-file "$MESON_CROSS_FILE"; + ninja -C "$MESON_BUILDDIR"; + + - name: Build nolibc with meson + run: | + if [[ "${{matrix.arch}}" == "x86_64" || "${{matrix.arch}}" == "x86" || "${{matrix.arch}}" == "aarch64" ]]; then \ + rm -r "$MESON_BUILDDIR"; \ + meson setup "$MESON_BUILDDIR" -Dnolibc=true -Dtests=true -Dexamples=true --cross-file "$MESON_CROSS_FILE"; \ + ninja -C "$MESON_BUILDDIR"; \ + else \ + echo "Skipping nolibc build, this arch doesn't support building liburing without libc"; \ + fi; + + - name: Test meson install + run: | + sudo meson install -C "$MESON_BUILDDIR" From patchwork Wed Jul 27 15:27:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fischer X-Patchwork-Id: 12930488 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D985BC19F2D for ; Wed, 27 Jul 2022 15:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231748AbiG0Pef (ORCPT ); Wed, 27 Jul 2022 11:34:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233934AbiG0Pec (ORCPT ); Wed, 27 Jul 2022 11:34:32 -0400 Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98B11237F4 for ; Wed, 27 Jul 2022 08:34:31 -0700 (PDT) Received: (qmail 15389 invoked by uid 989); 27 Jul 2022 15:27:48 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) From: Florian Fischer To: io-uring@vger.kernel.org Cc: Florian Schmaus , Florian Fischer Subject: [PATCH liburing 9/9] meson: update available examples to liburing 2.3 Date: Wed, 27 Jul 2022 17:27:23 +0200 Message-Id: <20220727152723.3320169-10-florian.fischer@muhq.space> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727152723.3320169-1-florian.fischer@muhq.space> References: <20220727152723.3320169-1-florian.fischer@muhq.space> MIME-Version: 1.0 X-Rspamd-Bar: ----- X-Rspamd-Report: R_MISSING_CHARSET(0.5) MIME_GOOD(-0.1) REPLY(-4) MID_CONTAINS_FROM(1) BAYES_HAM(-2.999993) X-Rspamd-Score: -5.599993 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Wed, 27 Jul 2022 17:27:48 +0200 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org Use an array of sources instead of declaring each example individually. Add examples introduced by Pavel and Dylan in 82001392, c1d15e78 and 61d472b. Signed-off-by: Florian Fischer --- examples/meson.build | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/examples/meson.build b/examples/meson.build index becfc02..e7f5daf 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -1,17 +1,19 @@ -executable('io_uring-cp', - 'io_uring-cp.c', - dependencies: uring) - -executable('io_uring-test', - 'io_uring-test.c', - dependencies: uring) - -executable('link-cp', - 'link-cp.c', - dependencies: uring) +example_sources = [ + 'io_uring-cp.c', + 'io_uring-test.c', + 'io_uring-udp.c', + 'link-cp.c', + 'poll-bench.c', + 'send-zerocopy.c', +] if has_ucontext - executable('ucontext-cp', - 'ucontext-cp.c', - dependencies: uring) + example_sources += ['ucontext-cp.c'] endif + +foreach source: example_sources + name = source.split('.')[0] + executable(name, + source, + dependencies: uring) +endforeach