Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -23,32 +23,36 @@ 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:
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: |-
brew install meson cmake pkg-config libffi libgit2 nanomsg
pip3 install cram==0.7
sudo pip3 install cram==0.7
<<: *pipeline
test_script: ninja -C build test

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
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:
Expand All @@ -60,5 +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
36 changes: 36 additions & 0 deletions ci/cram-fix-winenv.patch
Original file line number Diff line number Diff line change
@@ -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?=
<laszlo.varady@protonmail.com>
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

26 changes: 26 additions & 0 deletions ci/cram-ignore-cr.patch
Original file line number Diff line number Diff line change
@@ -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?=
<laszlo.varady@protonmail.com>
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

1 change: 1 addition & 0 deletions include/criterion/internal/assert/ieee.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#ifdef __cplusplus

# include <cmath>
# include <limits>

namespace criterion { namespace internal { namespace operators {

Expand Down
3 changes: 2 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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'])

Expand Down Expand Up @@ -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')
Expand Down
9 changes: 1 addition & 8 deletions src/protocol/criterion.pb.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -40,10 +40,3 @@ PB_BIND(criterion_protocol_submessage, criterion_protocol_submessage, AUTO)


PB_BIND(criterion_protocol_msg, criterion_protocol_msg, AUTO)







28 changes: 14 additions & 14 deletions src/protocol/criterion.pb.h
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand All @@ -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 */
Expand All @@ -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) \
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand All @@ -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" */
Expand Down
2 changes: 1 addition & 1 deletion subprojects/boxfort.wrap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[wrap-git]
directory = boxfort
url = https://github.com/Snaipe/BoxFort.git
revision = 1f0c6e94a8e5279389b209477faa333752ff5298
revision = 38c49b14189fb66f0a97ea892d93ff4f948e9e00
2 changes: 1 addition & 1 deletion subprojects/nanomsg.wrap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[wrap-git]
directory = nanomsg
url = https://github.com/nanomsg/nanomsg
revision = master
revision = bb59a9f2a4b4fb4c7ee0ab622eb0bdc8a24a5167
depth = 1
2 changes: 1 addition & 1 deletion subprojects/nanopb.wrap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[wrap-git]
directory = nanopb
url = https://github.com/nanopb/nanopb
revision = nanopb-0.4.0
revision = nanopb-0.4.5
3 changes: 1 addition & 2 deletions test/cram/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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