From 31e2acf989935ffad7044b149062bad4935d5c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 11 Nov 2021 16:42:20 +0100 Subject: [PATCH 01/10] ieee: include for C++ implementation of CRI_IEEE_* error: 'numeric_limits' is not a member of 'std' --- include/criterion/internal/assert/ieee.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/criterion/internal/assert/ieee.h b/include/criterion/internal/assert/ieee.h index 3b6de3bf..2063d87f 100644 --- a/include/criterion/internal/assert/ieee.h +++ b/include/criterion/internal/assert/ieee.h @@ -29,6 +29,7 @@ #ifdef __cplusplus # include +# include namespace criterion { namespace internal { namespace operators { From 118b0ab560d124f19d91d0278f667b590e70356f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 11 Nov 2021 16:48:39 +0100 Subject: [PATCH 02/10] ci: update to FreeBSD 13.0 --- .cirrus.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index aa2725c6..9e3af907 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -42,7 +42,7 @@ MacOS_task: FreeBSD_task: freebsd_instance: - image_family: freebsd-12-0 + image_family: freebsd-13-0 setup_script: |- pkg install -y gettext-tools pkgconf cmake meson git libffi libgit2 nanomsg python3 -m ensurepip @@ -61,4 +61,3 @@ Windows (mingw-gcc)_task: choco install -y --no-progress ninja cmake pip install meson cram==0.7 <<: *pipeline - From a5883ccb595b15432aaa9a93cf6f76fade714da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 11 Nov 2021 17:03:58 +0100 Subject: [PATCH 03/10] ci: update to macOS monterey-xcode-13.1 --- .cirrus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 9e3af907..e07d5504 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -31,8 +31,8 @@ Alpine (gcc,i386)_task: <<: *pipeline MacOS_task: - osx_instance: - image: mojave-xcode-10.2 + macos_instance: + image: monterey-xcode-13.1 env: PKG_CONFIG_PATH: ${PKG_CONFIG_PATH}:/usr/local/opt/libffi/lib/pkgconfig setup_script: |- From 585a66705af5c33eb74d9fdae69e8d66de98c708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 11 Nov 2021 17:22:28 +0100 Subject: [PATCH 04/10] subprojects: upgrade nanopb to v0.4.5 --- src/protocol/criterion.pb.c | 9 +-------- src/protocol/criterion.pb.h | 28 ++++++++++++++-------------- subprojects/nanopb.wrap | 2 +- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/protocol/criterion.pb.c b/src/protocol/criterion.pb.c index e07a1c89..a5f4d317 100644 --- a/src/protocol/criterion.pb.c +++ b/src/protocol/criterion.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.0 */ +/* Generated by nanopb-0.4.5 */ #include "criterion.pb.h" #if PB_PROTO_HEADER_VERSION != 40 @@ -40,10 +40,3 @@ PB_BIND(criterion_protocol_submessage, criterion_protocol_submessage, AUTO) PB_BIND(criterion_protocol_msg, criterion_protocol_msg, AUTO) - - - - - - - diff --git a/src/protocol/criterion.pb.h b/src/protocol/criterion.pb.h index 1bf236db..dc7a12c6 100644 --- a/src/protocol/criterion.pb.h +++ b/src/protocol/criterion.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.0 */ +/* Generated by nanopb-0.4.5 */ #ifndef PB_CRITERION_PROTOCOL_CRITERION_PB_H_INCLUDED #define PB_CRITERION_PROTOCOL_CRITERION_PB_H_INCLUDED @@ -9,10 +9,6 @@ #error Regenerate this file with the current version of nanopb generator. #endif -#ifdef __cplusplus -extern "C" { -#endif - /* Enum definitions */ typedef enum _criterion_protocol_phase_kind { criterion_protocol_phase_kind_SETUP = 1, @@ -161,6 +157,10 @@ typedef struct _criterion_protocol_msg { #define _criterion_protocol_ack_status_ARRAYSIZE ((criterion_protocol_ack_status)(criterion_protocol_ack_status_ERROR+1)) +#ifdef __cplusplus +extern "C" { +#endif + /* Initializer values for message structs */ #define criterion_protocol_birth_init_default {NULL, false, 0} #define criterion_protocol_phase_init_default {_criterion_protocol_phase_kind_MIN, NULL, false, 0, NULL} @@ -188,14 +188,14 @@ typedef struct _criterion_protocol_msg { #define criterion_protocol_msg_init_zero {0, 0, {0}, criterion_protocol_submessage_init_zero} /* Field tags (for use in manual encoding/decoding) */ +#define criterion_protocol_param_entry_name_tag 1 #define criterion_protocol_param_entry_raw_tag 2 #define criterion_protocol_param_entry_str_tag 3 -#define criterion_protocol_param_entry_name_tag 1 #define criterion_protocol_param_list_list_tag 1 -#define criterion_protocol_result_params_tag 3 -#define criterion_protocol_result_formatted_tag 4 #define criterion_protocol_result_repr_tag 1 #define criterion_protocol_result_message_tag 2 +#define criterion_protocol_result_params_tag 3 +#define criterion_protocol_result_formatted_tag 4 #define criterion_protocol_ack_status_code_tag 1 #define criterion_protocol_ack_message_tag 2 #define criterion_protocol_assert_message_tag 1 @@ -216,18 +216,18 @@ typedef struct _criterion_protocol_msg { #define criterion_protocol_phase_name_tag 2 #define criterion_protocol_phase_timestamp_tag 3 #define criterion_protocol_phase_message_tag 4 +#define criterion_protocol_statistic_key_tag 1 #define criterion_protocol_statistic_num_tag 3 #define criterion_protocol_statistic_str_tag 4 -#define criterion_protocol_statistic_key_tag 1 #define criterion_protocol_submessage_birth_tag 1 #define criterion_protocol_submessage_phase_tag 2 #define criterion_protocol_submessage_death_tag 3 #define criterion_protocol_submessage_message_tag 4 #define criterion_protocol_submessage_assert_tag 5 #define criterion_protocol_submessage_statistic_tag 6 +#define criterion_protocol_msg_version_tag 1 #define criterion_protocol_msg_pid_tag 2 #define criterion_protocol_msg_uid_tag 3 -#define criterion_protocol_msg_version_tag 1 #define criterion_protocol_msg_data_tag 16 /* Struct field encoding specification for nanopb */ @@ -243,14 +243,14 @@ X(a, POINTER, OPTIONAL, STRING, name, 2) \ X(a, STATIC, OPTIONAL, INT64, timestamp, 3) \ X(a, POINTER, OPTIONAL, STRING, message, 4) #define criterion_protocol_phase_CALLBACK NULL -#define criterion_protocol_phase_DEFAULT NULL +#define criterion_protocol_phase_DEFAULT (const pb_byte_t*)"\x08\x01\x00" #define criterion_protocol_death_FIELDLIST(X, a) \ X(a, STATIC, REQUIRED, UENUM, result, 1) \ X(a, STATIC, OPTIONAL, INT64, status, 2) \ X(a, STATIC, OPTIONAL, INT64, timestamp, 3) #define criterion_protocol_death_CALLBACK NULL -#define criterion_protocol_death_DEFAULT NULL +#define criterion_protocol_death_DEFAULT (const pb_byte_t*)"\x08\x01\x00" #define criterion_protocol_statistic_FIELDLIST(X, a) \ X(a, POINTER, REQUIRED, STRING, key, 1) \ @@ -327,7 +327,7 @@ X(a, STATIC, ONEOF, INT64, (id,pid,id.pid), 2) \ X(a, POINTER, ONEOF, STRING, (id,uid,id.uid), 3) \ X(a, STATIC, REQUIRED, MESSAGE, data, 16) #define criterion_protocol_msg_CALLBACK NULL -#define criterion_protocol_msg_DEFAULT (const uint8_t*)"\x08\x01\x00" +#define criterion_protocol_msg_DEFAULT (const pb_byte_t*)"\x08\x01\x00" #define criterion_protocol_msg_data_MSGTYPE criterion_protocol_submessage extern const pb_msgdesc_t criterion_protocol_birth_msg; @@ -360,7 +360,6 @@ extern const pb_msgdesc_t criterion_protocol_msg_msg; /* Maximum encoded size of messages (where known) */ /* criterion_protocol_birth_size depends on runtime parameters */ /* criterion_protocol_phase_size depends on runtime parameters */ -#define criterion_protocol_death_size 24 /* criterion_protocol_statistic_size depends on runtime parameters */ /* criterion_protocol_param_entry_size depends on runtime parameters */ /* criterion_protocol_param_list_size depends on runtime parameters */ @@ -370,6 +369,7 @@ extern const pb_msgdesc_t criterion_protocol_msg_msg; /* criterion_protocol_ack_size depends on runtime parameters */ /* criterion_protocol_submessage_size depends on runtime parameters */ /* criterion_protocol_msg_size depends on runtime parameters */ +#define criterion_protocol_death_size 24 #ifdef __cplusplus } /* extern "C" */ diff --git a/subprojects/nanopb.wrap b/subprojects/nanopb.wrap index 7ee118d1..02ba1b12 100644 --- a/subprojects/nanopb.wrap +++ b/subprojects/nanopb.wrap @@ -1,4 +1,4 @@ [wrap-git] directory = nanopb url = https://github.com/nanopb/nanopb -revision = nanopb-0.4.0 +revision = nanopb-0.4.5 From 71c4c0d85351de3acc62e6f0d622af03982e1b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 11 Nov 2021 18:45:36 +0100 Subject: [PATCH 05/10] build: define PB_NO_PACKED_STRUCTS for nanopb not to pack structures This commit fixes linking issues on macOS Monteray. --- meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 3d899240..0fabd94c 100644 --- a/meson.build +++ b/meson.build @@ -50,6 +50,7 @@ add_project_arguments( ]), '-DCRITERION_BUILDING_DLL=1', '-DPB_ENABLE_MALLOC=1', + '-DPB_NO_PACKED_STRUCTS=1', '-D_GNU_SOURCE', language: ['c', 'cpp']) @@ -174,7 +175,7 @@ if not nanopb.found() cmake_options: [ '-Dnanopb_BUILD_GENERATOR=OFF', '-DBUILD_SHARED_LIBS=OFF', - '-DCMAKE_C_FLAGS=-DPB_ENABLE_MALLOC', + '-DCMAKE_C_FLAGS=-DPB_ENABLE_MALLOC=1 -DPB_NO_PACKED_STRUCTS=1', '-DCMAKE_POSITION_INDEPENDENT_CODE=ON', ]) nanopb = nanopb_proj.dependency('protobuf-nanopb-static') From 4de794abe238edeab20522a3369d19068c022ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 11 Nov 2021 20:37:38 +0100 Subject: [PATCH 06/10] ci: fix pip3 install permissions in macOS job --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index e07d5504..3948fd11 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -37,7 +37,7 @@ MacOS_task: PKG_CONFIG_PATH: ${PKG_CONFIG_PATH}:/usr/local/opt/libffi/lib/pkgconfig setup_script: |- brew install meson cmake pkg-config libffi libgit2 nanomsg - pip3 install cram==0.7 + sudo pip3 install cram==0.7 <<: *pipeline FreeBSD_task: From 602d116bcfb813c272b964ba66146953fbfd5603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 11 Nov 2021 21:04:58 +0100 Subject: [PATCH 07/10] subprojects: bump boxfort revision --- subprojects/boxfort.wrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/boxfort.wrap b/subprojects/boxfort.wrap index 2c0ebe17..d108d654 100644 --- a/subprojects/boxfort.wrap +++ b/subprojects/boxfort.wrap @@ -1,4 +1,4 @@ [wrap-git] directory = boxfort url = https://github.com/Snaipe/BoxFort.git -revision = 1f0c6e94a8e5279389b209477faa333752ff5298 +revision = 38c49b14189fb66f0a97ea892d93ff4f948e9e00 From d719bbb0cff1c2b01ee591371717c284bf7c9803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Thu, 11 Nov 2021 21:05:29 +0100 Subject: [PATCH 08/10] subprojects: freeze nanomsg revision --- subprojects/nanomsg.wrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/nanomsg.wrap b/subprojects/nanomsg.wrap index 75aa09c8..c23b46f1 100644 --- a/subprojects/nanomsg.wrap +++ b/subprojects/nanomsg.wrap @@ -1,5 +1,5 @@ [wrap-git] directory = nanomsg url = https://github.com/nanomsg/nanomsg -revision = master +revision = bb59a9f2a4b4fb4c7ee0ab622eb0bdc8a24a5167 depth = 1 From f3f2c3ea04d843d6df7a248cfe89e86539f105cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Fri, 12 Nov 2021 16:35:56 +0100 Subject: [PATCH 09/10] build: specify shell for cram tests This is an attempt to fix cram tests in non-POSIX-compliant environment. --- test/cram/meson.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/cram/meson.build b/test/cram/meson.build index 10d42ea0..9fd89265 100644 --- a/test/cram/meson.build +++ b/test/cram/meson.build @@ -18,7 +18,6 @@ if sh.found() and cram.found() test('cram tests', cram, timeout: 240, - args: [meson.current_source_dir()], + args: ['--shell=' + sh.path(), meson.current_source_dir()], env: env) endif - From 87f5a8fc774fb68fa2ff71c35d1c832ce963180e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= Date: Mon, 22 Nov 2021 21:51:39 +0100 Subject: [PATCH 10/10] ci: fix cram tests on Windows This commit contains a patch for cram to fix an environment encoding issue: TypeError: environment can only contain strings Cram tests should be executed by `meson devenv`, because meson does not seem to add rpath entries on Windows. --- .cirrus.yml | 10 +++++++++- ci/cram-fix-winenv.patch | 36 ++++++++++++++++++++++++++++++++++++ ci/cram-ignore-cr.patch | 26 ++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 ci/cram-fix-winenv.patch create mode 100644 ci/cram-ignore-cr.patch diff --git a/.cirrus.yml b/.cirrus.yml index 3948fd11..1e56baed 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -5,7 +5,6 @@ _pipeline: &pipeline submodule-update_script: git submodule update --init --recursive configure_script: meson -Db_lundef=false build compile_script: ninja -C build - test_script: ninja -C build test Debian (gcc)_task: container: @@ -15,6 +14,7 @@ Debian (gcc)_task: apt-get install -y pkg-config cmake libgit2-dev libffi-dev libnanomsg-dev pip3 install cram==0.7 <<: *pipeline + test_script: ninja -C build test Alpine (gcc,x86_64)_task: container: @@ -23,12 +23,14 @@ Alpine (gcc,x86_64)_task: apk add --no-cache cmake libgit2-dev libffi-dev pip3 install cram==0.7 <<: *pipeline + test_script: ninja -C build test Alpine (gcc,i386)_task: container: image: snaipe/ci-meson:alpine-x86 setup_script: *alpine-deps <<: *pipeline + test_script: ninja -C build test MacOS_task: macos_instance: @@ -39,6 +41,7 @@ MacOS_task: brew install meson cmake pkg-config libffi libgit2 nanomsg sudo pip3 install cram==0.7 <<: *pipeline + test_script: ninja -C build test FreeBSD_task: freebsd_instance: @@ -49,6 +52,7 @@ FreeBSD_task: python3 -m pip install --upgrade pip python3 -m pip install cram==0.7 <<: *pipeline + test_script: ninja -C build test Windows (mingw-gcc)_task: windows_container: @@ -60,4 +64,8 @@ Windows (mingw-gcc)_task: choco install -y --no-progress python3 --params "/InstallDir:C:\Python" choco install -y --no-progress ninja cmake pip install meson cram==0.7 + git config --global core.autocrlf false + patch --forward --directory="C:\\Python\\Lib\\site-packages\\cram" < ci/cram-fix-winenv.patch + patch --forward --directory="C:\\Python\\Lib\\site-packages\\cram" < ci/cram-ignore-cr.patch <<: *pipeline + test_script: meson devenv -C build ninja test diff --git a/ci/cram-fix-winenv.patch b/ci/cram-fix-winenv.patch new file mode 100644 index 00000000..77a67060 --- /dev/null +++ b/ci/cram-fix-winenv.patch @@ -0,0 +1,36 @@ +From bde2ee57ba82a44d2b58ead114d4e00bbbf9bb31 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= + +Date: Mon, 22 Nov 2021 21:48:15 +0100 +Subject: [PATCH] Fix environment encoding on Windows + +cram adds an environment variable called TESTSHELL to each test. +Unfortunately, the value is encoded with fsencode, which produces a bytes +object on Windows, but Python on Windows does not support non-string +environment: + +'TESTSHELL': b'C:\\Program Files\\Git\\usr\\bin\\sh.EXE' + +File "C:\Python\lib\subprocess.py", line 1435, in _execute_child + hp, ht, pid, tid = _winapi.CreateProcess(executable, args, +TypeError: environment can only contain strings +--- + cram/_test.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cram/_test.py b/cram/_test.py +index 27ef99c..5099a82 100644 +--- a/cram/_test.py ++++ b/cram/_test.py +@@ -107,7 +107,7 @@ def test(lines, shell='/bin/sh', indent=2, testname=None, env=None, + + if isinstance(shell, (bytestype, unicodetype)): + shell = [shell] +- env['TESTSHELL'] = shell[0] ++ env['TESTSHELL'] = envencode(shell[0]) + + if debug: + stdin = [] +-- +2.34.0 + diff --git a/ci/cram-ignore-cr.patch b/ci/cram-ignore-cr.patch new file mode 100644 index 00000000..38231ab4 --- /dev/null +++ b/ci/cram-ignore-cr.patch @@ -0,0 +1,26 @@ +From 816b1f964b26e29f1113ef1c9a031b510d6311ce Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= + +Date: Tue, 23 Nov 2021 00:43:31 +0100 +Subject: [PATCH] Ignore "carriage return" + +--- + cram/_test.py | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/cram/_test.py b/cram/_test.py +index 5099a82..bef819c 100644 +--- a/cram/_test.py ++++ b/cram/_test.py +@@ -148,6 +148,8 @@ def test(lines, shell='/bin/sh', indent=2, testname=None, env=None, + if retcode == 80: + return (refout, None, []) + ++ output = output.replace(b'\r\n', b'\n') ++ + pos = -1 + ret = 0 + for i, line in enumerate(output[:-1].splitlines(True)): +-- +2.34.0 +