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
23 changes: 23 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@ jobs:
make test
fi

build-haiku:
name: "Haiku r1beta5"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v7

- name: Build and test in Haiku VM
uses: vmactions/haiku-vm@v1
with:
release: r1beta5
usesh: true
copyback: false
cache-after-prepare: true
envs: "BUILD_TYPE"
prepare: |
pkgman install -y cmd:cmake cmd:make cmd:python3
run: |
set -e
cmake -S . -B . -DCMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build .
make test

integration-test:
needs: build
strategy:
Expand Down
1 change: 1 addition & 0 deletions cmake.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#cmakedefine SOLARIS
#cmakedefine KFREEBSD
#cmakedefine GNUHURD
#cmakedefine HAIKU
#cmakedefine UNKNOWN

/* Found tm.tm_gmtoff struct member */
Expand Down
2 changes: 2 additions & 0 deletions cmake/CXXSniffer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "GNU")
set (GNUHURD true)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "CYGWIN")
set (CYGWIN true)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
set (HAIKU true)
else (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set (UNKNOWN true)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
Expand Down
21 changes: 20 additions & 1 deletion src/shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,13 @@ int execute (
select_retval = select (std::max (pout[0], pin[1]) + 1, &rfds, &wfds, nullptr, &tv);

if (select_retval == -1)
{
// Haiku (and probably some very old-school UNIXs) fails with EINTR or
// EAGAIN when SIGCHLD arrives during a blocking call. Retrying fixes it.
if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
continue;
throw std::string (std::strerror (errno));
}

// Write data to child's STDIN
if (FD_ISSET (pin[1], &wfds))
Expand All @@ -864,6 +870,11 @@ int execute (
// We don't really care; pretend we wrote it all.
write_retval = input.size () - written;
}
else if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
{
// Interrupted, try again.
write_retval = 0;
}
else
{
throw std::string (std::strerror (errno));
Expand All @@ -883,7 +894,11 @@ int execute (
{
read_retval = read (pout[0], &buf, sizeof (buf) - 1);
if (read_retval == -1)
{
if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
continue;
throw std::string (std::strerror (errno));
}

buf[read_retval] = '\0';
output += buf;
Expand All @@ -893,7 +908,11 @@ int execute (
close (pout[0]); // Close the read end of the output pipe.

int status = -1;
if (wait (&status) == -1)
int wait_retval;
do
wait_retval = waitpid (pid, &status, 0);
while (wait_retval == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
if (wait_retval == -1)
throw std::string (std::strerror (errno));

if (WIFEXITED (status))
Expand Down
6 changes: 6 additions & 0 deletions test/unicode.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <clocale>
#include <test.h>
#include <unicode.h>
#include <cmake.h>

////////////////////////////////////////////////////////////////////////////////
int main (int, char**)
Expand Down Expand Up @@ -179,7 +180,12 @@ int main (int, char**)
// t.ok (unicodeAlpha (0x00DF), "U+00DF (ß) unicodeAlpha");
// t.ok (unicodeAlpha (0x00E9), "U+00E9 (é) unicodeAlpha");
// t.ok (unicodeAlpha (0x00F6), "U+00F6 (ö) unicodeAlpha");
#ifdef HAIKU
// Haiku classifies So symbols as Unicode printables, not punctuation.
t.skip ("U+3004 ! unicodeAlpha");
#else
t.notok (unicodeAlpha (0x3004), "U+3004 (〄) ! unicodeAlpha");
#endif

return 0;
}
Expand Down