Skip to content
Open
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
47 changes: 47 additions & 0 deletions .github/workflows/haiku-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Haiku Test

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
- develop
tags:
- v*.*.*

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Haiku Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build: [debug, relwithdebinfo, release]
arch: [x86-64]

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run Haiku VM
uses: cross-platform-actions/action@v1.2.0
with:
operating_system: haiku
version: r1beta5
architecture: ${{ matrix.arch }}
shell: sh
run: |
sh ./tools/metacall-environment.sh base

mkdir -p build && cd build

sh ../tools/metacall-configure.sh ${{ matrix.build }} scripts tests

sh ../tools/metacall-build.sh ${{ matrix.build }} tests
4 changes: 4 additions & 0 deletions source/dynlink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ set(generated_source_path "${CMAKE_CURRENT_BINARY_DIR}/source")
if(APPLE AND PROJECT_OS_VERSION GREATER 8)
# From macOS 10.5 (version 9), dlopen compatible library is available
set(DYNLINK_IMPL_INTERFACE_NAME unix)
elseif(PROJECT_OS_HAIKU)
# Haiku can use dlopen although it's BeOS family
set(DYNLINK_IMPL_INTERFACE_NAME unix)
else()
set(DYNLINK_IMPL_INTERFACE_NAME ${PROJECT_OS_FAMILY})

endif()

set(headers
Expand Down
22 changes: 9 additions & 13 deletions source/serials/rapid_json_serial/source/rapid_json_serial_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,20 @@

typedef struct rapid_json_document_type
{
rapidjson::MemoryPoolAllocator<> json_allocator;
rapidjson::Document impl;
memory_allocator allocator;

} * rapid_json_document;
} *rapid_json_document;

/* -- Private Methods -- */

static void rapid_json_serial_impl_serialize_value(value v, rapidjson::Value *json_v);
static void rapid_json_serial_impl_serialize_value(value v, rapidjson::Value *json_v, rapidjson::MemoryPoolAllocator<> &rapid_json_allocator);

static char *rapid_json_serial_impl_document_stringify(rapid_json_document document, size_t *size);

static value rapid_json_serial_impl_deserialize_value(const rapidjson::Value *v);

/* -- Classes -- */

static thread_local rapidjson::MemoryPoolAllocator<> rapid_json_allocator;

/* -- Methods -- */

const char *rapid_json_serial_impl_extension()
Expand All @@ -76,13 +73,12 @@ serial_handle rapid_json_serial_impl_initialize(memory_allocator allocator)
{
return NULL;
}

document->allocator = allocator;

return (serial_handle)document;
}

void rapid_json_serial_impl_serialize_value(value v, rapidjson::Value *json_v)
void rapid_json_serial_impl_serialize_value(value v, rapidjson::Value *json_v, rapidjson::MemoryPoolAllocator<> &rapid_json_allocator)
{
type_id id = value_type_id(v);

Expand Down Expand Up @@ -197,7 +193,7 @@ void rapid_json_serial_impl_serialize_value(value v, rapidjson::Value *json_v)

rapidjson::Value json_inner_value;

rapid_json_serial_impl_serialize_value(current_value, &json_inner_value);
rapid_json_serial_impl_serialize_value(current_value, &json_inner_value, rapid_json_allocator);

json_array.PushBack(json_inner_value, rapid_json_allocator);
}
Expand All @@ -218,9 +214,9 @@ void rapid_json_serial_impl_serialize_value(value v, rapidjson::Value *json_v)

rapidjson::Value json_member, json_inner_value;

rapid_json_serial_impl_serialize_value(tupla_array[0], &json_member);
rapid_json_serial_impl_serialize_value(tupla_array[0], &json_member, rapid_json_allocator);

rapid_json_serial_impl_serialize_value(tupla_array[1], &json_inner_value);
rapid_json_serial_impl_serialize_value(tupla_array[1], &json_inner_value, rapid_json_allocator);

json_map.AddMember(json_member, json_inner_value, rapid_json_allocator);
}
Expand Down Expand Up @@ -319,7 +315,7 @@ void rapid_json_serial_impl_serialize_value(value v, rapidjson::Value *json_v)

json_member.SetString(str, length);

rapid_json_serial_impl_serialize_value(throwable_value(th), &json_inner_value);
rapid_json_serial_impl_serialize_value(throwable_value(th), &json_inner_value, rapid_json_allocator);

json_map.AddMember(json_member, json_inner_value, rapid_json_allocator);
}
Expand Down Expand Up @@ -374,7 +370,7 @@ char *rapid_json_serial_impl_serialize(serial_handle handle, value v, size_t *si
return NULL;
}

rapid_json_serial_impl_serialize_value(v, &document->impl);
rapid_json_serial_impl_serialize_value(v, &document->impl, document->json_allocator);

return rapid_json_serial_impl_document_stringify(document, size);
}
Expand Down
17 changes: 15 additions & 2 deletions tools/metacall-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,20 @@ sub_build() {
if [ $BUILD_MEMCHECK = 1 ]; then
cmake --build . -j$(getconf _NPROCESSORS_ONLN) --target memcheck
else
# Tests (coverage needs to run the tests)
if [ $BUILD_TESTS = 1 ] || [ $BUILD_BENCHMARKS = 1 ] || [ $BUILD_COVERAGE = 1 ]; then
ctest -j$(getconf _NPROCESSORS_ONLN) --timeout 5400 --output-on-failure --test-output-size-failed 3221000000 -C $BUILD_TYPE
if [ "$(uname -s)" = "Haiku" ]; then
mkdir -p ~/config/settings/system/debug_server
printf 'default_action report\n' > ~/config/settings/system/debug_server/settings
fi

ctest -j$(getconf _NPROCESSORS_ONLN) --timeout 5400 --output-on-failure --test-output-size-failed 3221000000 -C $BUILD_TYPE || tests_exit=$?

if [ "$(uname -s)" = "Haiku" ] && [ "${tests_exit:-0}" != "0" ]; then
echo "===== HAIKU CRASH REPORTS ====="
cat ~/Desktop/*report* 2>/dev/null || true
echo "===== HAIKU SYSLOG TAIL ====="
tail -n 200 /boot/system/var/log/syslog 2>/dev/null || true
fi
fi

# Coverage
Expand All @@ -103,6 +114,8 @@ sub_build() {
$SUDO_CMD HOME="$HOME" cmake --build . --target install
fi
fi

return ${tests_exit:-0}
}

sub_help() {
Expand Down