diff --git a/Makefile b/Makefile index db0c2ea9..af064e1a 100644 --- a/Makefile +++ b/Makefile @@ -627,7 +627,7 @@ test: apitest ecmatest # Set of miscellaneous tests for release. .PHONY: releasetest -releasetest: configuretest xmldoctest closuretest bluebirdtest luajstest jsinterpretertest lodashtest underscoretest emscriptenluatest emscriptenduktest emscripteninceptiontest emscriptenmandeltest emscriptentest errorinjecttest +releasetest: configuretest xmldoctest closuretest bluebirdtest luajstest jsinterpretertest lodashtest underscoretest emscriptenluatest emscriptenduktest emscriptenmandeltest emscriptentest errorinjecttest @echo "" @echo "### Release tests successful!" # These tests now have output checks. @@ -1183,6 +1183,7 @@ docker-images-x64: docker-prepare docker build -t duktape-site-ubuntu-18.04-x64 docker/duktape-site-ubuntu-18.04-x64 docker build -t duktape-duk-ubuntu-18.04-x64 docker/duktape-duk-ubuntu-18.04-x64 docker build -t duktape-shell-ubuntu-18.04-x64 docker/duktape-shell-ubuntu-18.04-x64 + docker build -t duktape-release-1-ubuntu-18.04-x64 docker/duktape-release-1-ubuntu-18.04-x64 .PHONY: docker-images-s390x docker-images-s390x: docker-prepare @@ -1196,6 +1197,7 @@ docker-images: docker-images-x64 docker-clean: -rm -f docker/*/gitconfig docker/*/prepare_repo.sh -docker rmi \ + duktape-release-1-ubuntu-18.04-x64:latest \ duktape-shell-ubuntu-18.04-x64:latest \ duktape-duk-ubuntu-18.04-x64:latest \ duktape-site-ubuntu-18.04-x64:latest \ @@ -1262,3 +1264,10 @@ docker-shell-wd: .PHONY: docker-shell-wdmount docker-shell-wdmount: docker run -v $(shell pwd):/work/duktape --rm -ti duktape-shell-ubuntu-18.04-x64 + +.PHONY: docker-release-1-wd +docker-release-1-wd: + rm -f docker-input.zip docker-output.zip + #git archive --format zip --output docker-input.zip HEAD + zip -1 -q -r docker-input.zip . + docker run --rm -i -e STDIN_ZIP=1 duktape-release-1-ubuntu-18.04-x64 < docker-input.zip diff --git a/docker/duktape-release-1-ubuntu-18.04-x64/Dockerfile b/docker/duktape-release-1-ubuntu-18.04-x64/Dockerfile new file mode 100644 index 00000000..c6afb590 --- /dev/null +++ b/docker/duktape-release-1-ubuntu-18.04-x64/Dockerfile @@ -0,0 +1,6 @@ +FROM duktape-base-ubuntu-18.04-x64:latest + +COPY --chown=duktape:duktape run.sh . +RUN chmod 755 run.sh + +CMD /work/run.sh diff --git a/docker/duktape-release-1-ubuntu-18.04-x64/run.sh b/docker/duktape-release-1-ubuntu-18.04-x64/run.sh new file mode 100644 index 00000000..594ce4f2 --- /dev/null +++ b/docker/duktape-release-1-ubuntu-18.04-x64/run.sh @@ -0,0 +1,138 @@ +#!/bin/bash + +set -e +set -x + +/work/prepare_repo.sh + +source emsdk/emsdk_env.sh + +cd duktape +ROOT=`pwd` + +test_combined_source_compilation() { + make clean dist + cd dist + cat Makefile.cmdline + rm -rf src-separate + make -f Makefile.cmdline + ls -l duk; size duk + ./duk mandel.js > /tmp/out.txt + cat /tmp/out.txt + if [ `md5sum /tmp/out.txt | cut -f 1 -d ' '` != "627cd86f0a4255e018c564f86c6d0ab3" ]; then + echo "Combined source compilation failed!" + exit 1 + fi +} + +test_separate_source_compilation() { + make clean dist + cd dist + sed -i 's/DUKTAPE_SOURCES = src\/duktape.c/DUKTAPE_SOURCES = src-separate\/*.c/' Makefile.cmdline + sed -i 's/-I.\/src/-I.\/src-separate/' Makefile.cmdline + cat Makefile.cmdline + rm -rf src + make -f Makefile.cmdline + ls -l duk; size duk + ./duk mandel.js > /tmp/out.txt + cat /tmp/out.txt + if [ `md5sum /tmp/out.txt | cut -f 1 -d ' '` != "627cd86f0a4255e018c564f86c6d0ab3" ]; then + echo "Combined source compilation failed!" + exit 1 + fi +} + +test_clang_compilation() { + make clean duk-clang +} + +test_gxx_compilation() { + make clean duk-g++ + make clean dukd-g++ +} + +test_misc_compilation() { + make clean duk-rom + make clean duk-low + make clean duk-low-norefc + make clean duk-low-rom + make clean duk-perf + make clean duk-size + make clean duk-pgo.O2 + make clean dukd + make clean dukd-rom + make clean dukd-low + make clean dukd-low-norefc + make clean dukd-low-rom +} + +test_configure_fastint() { + make clean dist + cd dist + rm -rf /tmp/out + python tools/configure.py -DDUK_USE_FASTINT --output-directory /tmp/out + ls -l /tmp/out +} + +test_releasetest() { + make clean + make releasetest +} + +test_checklist_compile_test() { + make clean dist + cd dist + bash ../util/checklist_compile_test.sh +} + +echo "" +echo "*** Test compilation from combined sources" +echo "" +cd $ROOT +test_combined_source_compilation + +echo "" +echo "*** Test compilation from separate sources" +echo "" +cd $ROOT +test_separate_source_compilation + +echo "" +echo "*** Test clang compilation (duk-clang)" +echo "" +cd $ROOT +test_clang_compilation + +echo "" +echo "*** Test C++ compilation (duk-g++)" +echo "" +cd $ROOT +test_gxx_compilation + +echo "" +echo "*** Test misc compilation targets (duk-low, etc)" +echo "" +cd $ROOT +test_misc_compilation + +echo "" +echo "*** Test configure.py -DDUK_USE_FASTINT" +echo "" +cd $ROOT +test_configure_fastint + +echo "" +echo "*** Test make releasetest" +echo "" +cd $ROOT +test_releasetest + +echo "" +echo "*** Test checklist_compile_test.sh" +echo "" +cd $ROOT +test_checklist_compile_test + +echo "" +echo "*** All done!" +echo "" diff --git a/src-input/builtins.yaml b/src-input/builtins.yaml index 59df17e6..2a9598aa 100644 --- a/src-input/builtins.yaml +++ b/src-input/builtins.yaml @@ -2337,6 +2337,7 @@ objects: setter_magic: 0 attributes: "c" duktape: true + # XXX: columnNumber - key: "toString" value: diff --git a/src-input/duk_api_bytecode.c b/src-input/duk_api_bytecode.c index e2cec496..76fe5bd5 100644 --- a/src-input/duk_api_bytecode.c +++ b/src-input/duk_api_bytecode.c @@ -395,7 +395,7 @@ static const duk_uint8_t *duk__load_func(duk_hthread *thr, const duk_uint8_t *p, DUK_ASSERT(thr != NULL); - DUK_DD(DUK_DDPRINT("loading function, p=%p, p_end=%p", (void *) p, (void *) p_end)); + DUK_DD(DUK_DDPRINT("loading function, p=%p, p_end=%p", (const void *) p, (const void *) p_end)); DUK__ASSERT_LEFT(3 * 4); count_instr = DUK_RAW_READINC_U32_BE(p); diff --git a/src-input/duk_api_stack.c b/src-input/duk_api_stack.c index b865372c..1b895b05 100644 --- a/src-input/duk_api_stack.c +++ b/src-input/duk_api_stack.c @@ -6313,6 +6313,13 @@ DUK_INTERNAL duk_idx_t duk_unpack_array_like(duk_hthread *thr, duk_idx_t idx) { * Error throwing */ +#if defined(DUK_USE_GCC_PRAGMAS) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn" +#elif defined(DUK_USE_CLANG_PRAGMAS) +#pragma clang diagnostic push +#endif + DUK_EXTERNAL void duk_throw_raw(duk_hthread *thr) { duk_tval *tv_val; @@ -6402,6 +6409,12 @@ DUK_EXTERNAL void duk_error_raw(duk_hthread *thr, duk_errcode_t err_code, const DUK_WO_NORETURN(return;); } +#if defined(DUK_USE_GCC_PRAGMAS) +#pragma GCC diagnostic pop +#elif defined(DUK_USE_CLANG_PRAGMAS) +#pragma clang diagnostic pop +#endif + #if !defined(DUK_USE_VARIADIC_MACROS) DUK_NORETURN(DUK_LOCAL_DECL void duk__throw_error_from_stash(duk_hthread *thr, duk_errcode_t err_code, const char *fmt, va_list ap)); diff --git a/src-input/duk_bi_buffer.c b/src-input/duk_bi_buffer.c index caa5bdbc..53b59be9 100644 --- a/src-input/duk_bi_buffer.c +++ b/src-input/duk_bi_buffer.c @@ -2263,11 +2263,11 @@ DUK_INTERNAL duk_ret_t duk_bi_nodejs_buffer_concat(duk_hthread *thr) { /* XXX: split into separate functions for each field type? */ DUK_INTERNAL duk_ret_t duk_bi_buffer_readfield(duk_hthread *thr) { - duk_small_int_t magic = (duk_small_int_t) duk_get_current_magic(thr); - duk_small_int_t magic_ftype; - duk_small_int_t magic_bigendian; - duk_small_int_t magic_signed; - duk_small_int_t magic_typedarray; + duk_small_uint_t magic = (duk_small_uint_t) duk_get_current_magic(thr); + duk_small_uint_t magic_ftype; + duk_small_uint_t magic_bigendian; + duk_small_uint_t magic_signed; + duk_small_uint_t magic_typedarray; duk_small_uint_t endswap; duk_hbufobj *h_this; duk_bool_t no_assert; @@ -2278,10 +2278,10 @@ DUK_INTERNAL duk_ret_t duk_bi_buffer_readfield(duk_hthread *thr) { duk_uint8_t *buf; duk_double_union du; - magic_ftype = magic & 0x0007; - magic_bigendian = magic & 0x0008; - magic_signed = magic & 0x0010; - magic_typedarray = magic & 0x0020; + magic_ftype = magic & 0x0007U; + magic_bigendian = magic & 0x0008U; + magic_signed = magic & 0x0010U; + magic_typedarray = magic & 0x0020U; h_this = duk__require_bufobj_this(thr); /* XXX: very inefficient for plain buffers */ DUK_ASSERT(h_this != NULL); @@ -2522,11 +2522,11 @@ DUK_INTERNAL duk_ret_t duk_bi_buffer_readfield(duk_hthread *thr) { #if defined(DUK_USE_BUFFEROBJECT_SUPPORT) /* XXX: split into separate functions for each field type? */ DUK_INTERNAL duk_ret_t duk_bi_buffer_writefield(duk_hthread *thr) { - duk_small_int_t magic = (duk_small_int_t) duk_get_current_magic(thr); - duk_small_int_t magic_ftype; - duk_small_int_t magic_bigendian; - duk_small_int_t magic_signed; - duk_small_int_t magic_typedarray; + duk_small_uint_t magic = (duk_small_uint_t) duk_get_current_magic(thr); + duk_small_uint_t magic_ftype; + duk_small_uint_t magic_bigendian; + duk_small_uint_t magic_signed; + duk_small_uint_t magic_typedarray; duk_small_uint_t endswap; duk_hbufobj *h_this; duk_bool_t no_assert; @@ -2538,10 +2538,10 @@ DUK_INTERNAL duk_ret_t duk_bi_buffer_writefield(duk_hthread *thr) { duk_double_union du; duk_int_t nbytes = 0; - magic_ftype = magic & 0x0007; - magic_bigendian = magic & 0x0008; - magic_signed = magic & 0x0010; - magic_typedarray = magic & 0x0020; + magic_ftype = magic & 0x0007U; + magic_bigendian = magic & 0x0008U; + magic_signed = magic & 0x0010U; + magic_typedarray = magic & 0x0020U; DUK_UNREF(magic_signed); h_this = duk__require_bufobj_this(thr); /* XXX: very inefficient for plain buffers */ @@ -2581,7 +2581,7 @@ DUK_INTERNAL duk_ret_t duk_bi_buffer_writefield(duk_hthread *thr) { * (offset + nbytes) even when write fails due to invalid offset. */ if (magic_ftype != DUK__FLD_VARINT) { - DUK_ASSERT(magic_ftype >= 0 && magic_ftype < (duk_small_int_t) (sizeof(duk__buffer_nbytes_from_fldtype) / sizeof(duk_uint8_t))); + DUK_ASSERT(magic_ftype < (duk_small_uint_t) (sizeof(duk__buffer_nbytes_from_fldtype) / sizeof(duk_uint8_t))); nbytes = duk__buffer_nbytes_from_fldtype[magic_ftype]; } else { nbytes = duk_get_int(thr, 2); diff --git a/src-input/duk_js_ops.c b/src-input/duk_js_ops.c index 2502df93..4b044cdb 100644 --- a/src-input/duk_js_ops.c +++ b/src-input/duk_js_ops.c @@ -1351,7 +1351,9 @@ DUK_INTERNAL duk_small_uint_t duk_js_typeof_stridx(duk_tval *tv_x) { DUK_INTERNAL duk_bool_t duk_js_isarray_hobject(duk_hobject *h) { DUK_ASSERT(h != NULL); +#if defined(DUK_USE_ES6_PROXY) h = duk_hobject_resolve_proxy_target(h); +#endif return (DUK_HOBJECT_GET_CLASS_NUMBER(h) == DUK_HOBJECT_CLASS_ARRAY ? 1 : 0); } diff --git a/src-input/duktape.h.in b/src-input/duktape.h.in index 4e49a74a..d58462e4 100644 --- a/src-input/duktape.h.in +++ b/src-input/duktape.h.in @@ -38,7 +38,7 @@ * development snapshots have 99 for patch level (e.g. 0.10.99 would be a * development version after 0.10.0 but before the next official release). */ -#define DUK_VERSION 20499L +#define DUK_VERSION 20500L /* Git commit, describe, and branch for Duktape build. Useful for * non-official snapshot builds so that application code can easily log diff --git a/tests/api/test-get-set-prototype.c b/tests/api/test-get-set-prototype.c index 987fdf11..8424d869 100644 --- a/tests/api/test-get-set-prototype.c +++ b/tests/api/test-get-set-prototype.c @@ -45,7 +45,7 @@ obj0.bar=123 /* Multiple basic tests in one: test duk_set_prototype() and duk_get_prototype() * stack top changes, and object/undefined for duk_set_prototype(). Also checks - * how a naked object works. + * how a bare object works. */ static duk_ret_t test_basic(duk_context *ctx, void *udata) { (void) udata; @@ -59,7 +59,7 @@ static duk_ret_t test_basic(duk_context *ctx, void *udata) { duk_push_int(ctx, 123); duk_put_prop_string(ctx, -2, "foo"); - /* The prototype object is "naked", read back its prototype. */ + /* The prototype object is "bare", read back its prototype. */ printf("top before get: %ld\n", (long) duk_get_top(ctx)); duk_get_prototype(ctx, 0); printf("top after get: %ld\n", (long) duk_get_top(ctx)); @@ -88,7 +88,7 @@ static duk_ret_t test_basic(duk_context *ctx, void *udata) { duk_set_prototype(ctx, -2); printf("top after set: %ld\n", (long) duk_get_top(ctx)); - /* Read back the prototype. The object is "naked" and doesn't have + /* Read back the prototype. The object is "bare" and doesn't have * valueOf() or toString(), so that the string coercion will fail * here on purpose. Unfortunately this check depends on the specific * error message and is brittle.