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
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,39 @@ jobs:
emmake make -C build qjs_wasm -j$(getconf _NPROCESSORS_ONLN)
- name: result
run: ls -lh build

cygwin:
runs-on: windows-latest
defaults:
run:
shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
steps:
- name: Set up Cygwin
uses: cygwin/cygwin-install-action@master
with:
packages: make cmake gcc-g++ bash

- uses: actions/checkout@v3

- name: build

# Plain `make` fails here with this error:
# No rule to make target '/cygdrive/d/a/quickjs-ng/quickjs-ng/cutils.c',
# needed by 'CMakeFiles/qjs.dir/cutils.c.o'. Stop.
#
# For some reason, making the build directory then `make`ing in there
# fixes it.
run: |
cd $GITHUB_WORKSPACE
make build/CMakeCache.txt
make --directory build

- name: stats
run: |
cd $GITHUB_WORKSPACE
make --debug stats

- name: test
run: |
cd $GITHUB_WORKSPACE
make --debug test
4 changes: 2 additions & 2 deletions qjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <time.h>
#if defined(__APPLE__)
#include <malloc/malloc.h>
#elif defined(__linux__)
#elif defined(__linux__) || defined(__CYGWIN__)
#include <malloc.h>
#endif

Expand Down Expand Up @@ -259,7 +259,7 @@ static const JSMallocFunctions trace_mf = {
(size_t (*)(const void *))_msize,
#elif defined(EMSCRIPTEN)
NULL,
#elif defined(__linux__)
#elif defined(__linux__) || defined(__CYGWIN__)
(size_t (*)(const void *))malloc_usable_size,
#else
/* change this to `NULL,` if compilation fails */
Expand Down
2 changes: 2 additions & 0 deletions quickjs-libc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3582,6 +3582,8 @@ void js_std_set_worker_new_context_func(JSContext *(*func)(JSRuntime *rt))
#define OS_PLATFORM "darwin"
#elif defined(EMSCRIPTEN)
#define OS_PLATFORM "js"
#elif defined(__CYGWIN__)
#define OS_PLATFORM "cygwin"
#else
#define OS_PLATFORM "linux"
#endif
Expand Down
4 changes: 2 additions & 2 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <math.h>
#if defined(__APPLE__)
#include <malloc/malloc.h>
#elif defined(__linux__)
#elif defined(__linux__) || defined(__CYGWIN__)
#include <malloc.h>
#elif defined(__FreeBSD__)
#include <malloc_np.h>
Expand Down Expand Up @@ -1722,7 +1722,7 @@ static const JSMallocFunctions def_malloc_funcs = {
(size_t (*)(const void *))_msize,
#elif defined(EMSCRIPTEN)
NULL,
#elif defined(__linux__)
#elif defined(__linux__) || defined (__CYGWIN__)
(size_t (*)(const void *))malloc_usable_size,
#else
/* change this to `NULL,` if compilation fails */
Expand Down
4 changes: 2 additions & 2 deletions run-test262.c
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ int run_test(const char *filename, int index)
/* XXX: should extract the phase */
char *q = find_tag(p, "type:", &state);
if (q) {
while (isspace(*q))
while (isspace((unsigned char)*q))
q++;
error_type = strdup_len(q, strcspn(q, " \n"));
}
Expand Down Expand Up @@ -2089,7 +2089,7 @@ int main(int argc, char **argv)
update_exclude_dirs();

if (is_dir_list) {
if (optind < argc && !isdigit(argv[optind][0])) {
if (optind < argc && !isdigit((unsigned char)argv[optind][0])) {
filename = argv[optind++];
namelist_load(&test_list, filename);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/test_builtin.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ function test_number()
assert(Number.isNaN(Number("-")));
assert(Number.isNaN(Number("\x00a")));

// TODO: Fix rounding errors on Windows.
if (os.platform === 'win32') {
// TODO: Fix rounding errors on Windows/Cygwin.
if (['win32', 'cygwin'].includes(os.platform)) {
return;
}

Expand Down