Browse Source

Merge branch 'misc-release-cleanup-fixes'

Misc small fixes prior to 1.3.0 release
pull/344/head
Sami Vaarala 9 years ago
parent
commit
ac38e03384
  1. 8
      config/genconfig.py
  2. 2
      dist-files/README.rst
  3. 10
      doc/release-checklist.rst
  4. 4
      doc/release-notes-v1-3.rst
  5. 30
      src/duk_selftest.c
  6. 30
      tests/api/test-all-public-symbols.c
  7. 21
      tests/ecmascript/test-bi-global-parseint.js
  8. 2
      website/guide/performance.html

8
config/genconfig.py

@ -184,6 +184,8 @@ class Snippet:
def __init__(self, lines, provides=None, requires=None, autoscan_requires=True, autoscan_provides=True):
self.lines = []
if not isinstance(lines, list):
raise Exception('Snippet constructor must be a list (not e.g. a string): %s' % repr(lines))
for line in lines:
if isinstance(line, str):
self.lines.append(line)
@ -307,16 +309,16 @@ class FileBuilder:
def cpp_error(self, msg):
# XXX: assume no newlines etc
self.vals.append(Snippet('#error %s' % msg))
self.vals.append(Snippet([ '#error %s' % msg ]))
def cpp_warning(self, msg):
# XXX: assume no newlines etc
# XXX: support compiler specific warning mechanisms
if self.use_cpp_warning:
# C preprocessor '#warning' is often supported
self.vals.append(Snippet('#warning %s' % msg))
self.vals.append(Snippet([ '#warning %s' % msg ]))
else:
self.vals.append(Snippet('/* WARNING: %s */' % msg))
self.vals.append(Snippet([ '/* WARNING: %s */' % msg ]))
def cpp_warning_or_error(self, msg, is_error=True):
if is_error:

2
dist-files/README.rst

@ -60,7 +60,7 @@ This distributable contains:
* ``src-separate/``: main Duktape library in multiple files format.
* ``config/``: genconfig utility for creating duk_config.h configuration
files for non-mainline platforms, and some prebuilt config headers.
files, see: http://wiki.duktape.org/Configuring.html.
* ``examples/``: further examples for using Duktape. Although Duktape
itself is widely portable, some of the examples are Linux only.

10
doc/release-checklist.rst

@ -45,6 +45,10 @@ Checklist for ordinary releases
- Release date is in place
* Ensure tests/api/test-all-public-symbols.c is up-to-date
- Must add all new API calls
* Compilation tests:
- Clean compile for command line tool with (a) no options and (b) common
@ -95,9 +99,9 @@ Checklist for ordinary releases
macros::
> cd dist
> cl /O2 /DDUK_OPT_DLL_BUILD /Isrc /LD src\duktape.c
> cl /O2 /DDUK_OPT_DLL_BUILD /Isrc examples\cmdline\duk_cmdline.c duktape.lib
> duk_cmdline.exe
> cl /W3 /O2 /DDUK_OPT_DLL_BUILD /Isrc /LD src\duktape.c
> cl /W3 /O2 /DDUK_OPT_DLL_BUILD /Isrc /Feduk.exe examples\cmdline\duk_cmdline.c duktape.lib
> duk.exe
* Ecmascript testcases

4
doc/release-notes-v1-3.rst

@ -52,6 +52,10 @@ from Duktape v1.2.x. Note the following:
only triggered when execution enters the exact breakpoint line. Breakpoints
on lines without any executable code are ignored.
* Some example files have been renamed. For example,
``examples/debug-trans-socket/duk_debug_trans_socket.*`` have been renamed
to ``examples/debug-trans-socket/duk_trans_socket.*``.
There are bug fixes and other minor behavioral changes which may affect some
applications, see ``RELEASES.rst`` for details.

30
src/duk_selftest.c

@ -296,7 +296,7 @@ DUK_LOCAL void duk__selftest_64bit_arithmetic(void) {
* Casting
*/
DUK_LOCAL void duk__selftest_cast_double_to_uint(void) {
DUK_LOCAL void duk__selftest_cast_double_to_small_uint(void) {
/*
* https://github.com/svaarala/duktape/issues/127#issuecomment-77863473
*/
@ -307,12 +307,14 @@ DUK_LOCAL void duk__selftest_cast_double_to_uint(void) {
duk_double_t d1v, d2v;
duk_small_uint_t uv;
/* Test without volatiles */
d1 = 1.0;
u = (duk_small_uint_t) d1;
d2 = (duk_double_t) u;
if (!(d1 == 1.0 && u == 1 && d2 == 1.0 && d1 == d2)) {
DUK_PANIC(DUK_ERR_INTERNAL_ERROR, "self test failed: double to uint cast failed");
DUK_PANIC(DUK_ERR_INTERNAL_ERROR, "self test failed: double to duk_small_uint_t cast failed");
}
/* Same test with volatiles */
@ -322,7 +324,26 @@ DUK_LOCAL void duk__selftest_cast_double_to_uint(void) {
d2v = (duk_double_t) uv;
if (!(d1v == 1.0 && uv == 1 && d2v == 1.0 && d1v == d2v)) {
DUK_PANIC(DUK_ERR_INTERNAL_ERROR, "self test failed: double to uint cast failed");
DUK_PANIC(DUK_ERR_INTERNAL_ERROR, "self test failed: double to duk_small_uint_t cast failed");
}
}
DUK_LOCAL void duk__selftest_cast_double_to_uint32(void) {
/*
* This test fails on an exotic ARM target; double-to-uint
* cast is incorrectly clamped to -signed- int highest value.
*
* https://github.com/svaarala/duktape/issues/336
*/
duk_double_t dv;
duk_uint32_t uv;
dv = 3735928559.0; /* 0xdeadbeef in decimal */
uv = (duk_uint32_t) dv;
if (uv != 0xdeadbeefUL) {
DUK_PANIC(DUK_ERR_INTERNAL_ERROR, "self test failed: double to duk_uint32_t cast failed");
}
}
@ -341,7 +362,8 @@ DUK_INTERNAL void duk_selftest_run_tests(void) {
duk__selftest_double_zero_sign();
duk__selftest_struct_align();
duk__selftest_64bit_arithmetic();
duk__selftest_cast_double_to_uint();
duk__selftest_cast_double_to_small_uint();
duk__selftest_cast_double_to_uint32();
}
#undef DUK__DBLUNION_CMP_TRUE

30
tests/api/test-all-public-symbols.c

@ -21,8 +21,8 @@ static duk_ret_t test_func(duk_context *ctx) {
return 0;
}
/* Up-to-date for Duktape 0.12.0, alphabetical order:
* $ cd website/api; ls *.txt
/* Up-to-date for Duktape 1.3.0, alphabetical order:
* $ cd website/api; ls *.yaml
*/
(void) duk_alloc_raw(ctx, 0);
@ -45,10 +45,15 @@ static duk_ret_t test_func(duk_context *ctx) {
(void) duk_compile_string(ctx, 0, "dummy");
(void) duk_compile(ctx, 0);
(void) duk_concat(ctx, 0);
(void) duk_config_buffer(ctx, 0, NULL, 0);
(void) duk_copy(ctx, 0, 0);
(void) duk_create_heap_default();
(void) duk_create_heap(NULL, NULL, NULL, NULL, NULL);
(void) duk_debugger_attach(ctx, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
(void) duk_debugger_cooperate(ctx);
(void) duk_debugger_detach(ctx);
(void) duk_decode_string(ctx, 0, NULL, NULL);
(void) duk_def_prop(ctx, 0, 0);
(void) duk_del_prop_index(ctx, 0, 0);
(void) duk_del_prop_string(ctx, 0, "dummy");
(void) duk_del_prop(ctx, 0);
@ -56,10 +61,12 @@ static duk_ret_t test_func(duk_context *ctx) {
(void) duk_destroy_heap(ctx);
(void) duk_dump_context_stderr(ctx);
(void) duk_dump_context_stdout(ctx);
(void) duk_dump_function(ctx);
(void) duk_dup_top(ctx);
(void) duk_dup(ctx, 0);
(void) duk_enum(ctx, 0, 0);
(void) duk_equals(ctx, 0, 0);
duk_error_va(ctx, 0, NULL, NULL);
duk_error(ctx, 0, "dummy"); /* (void) cast won't work without variadic macros */
(void) duk_eval_file_noresult(ctx, "dummy");
(void) duk_eval_file(ctx, "dummy");
@ -74,12 +81,15 @@ static duk_ret_t test_func(duk_context *ctx) {
(void) duk_free(ctx, NULL);
(void) duk_gc(ctx, 0);
(void) duk_get_boolean(ctx, 0);
(void) duk_get_buffer_data(ctx, 0, NULL);
(void) duk_get_buffer(ctx, 0, NULL);
(void) duk_get_c_function(ctx, 0);
(void) duk_get_context(ctx, 0);
(void) duk_get_current_magic(ctx);
(void) duk_get_error_code(ctx, 0);
(void) duk_get_finalizer(ctx, 0);
(void) duk_get_global_string(ctx, 0);
(void) duk_get_heapptr(ctx, 0);
(void) duk_get_int(ctx, 0);
(void) duk_get_length(ctx, 0);
(void) duk_get_lstring(ctx, 0, NULL);
@ -105,6 +115,7 @@ static duk_ret_t test_func(duk_context *ctx) {
(void) duk_hex_decode(ctx, 0);
(void) duk_hex_encode(ctx, 0);
(void) duk_insert(ctx, 0);
(void) duk_instanceof(ctx, 0, 0);
(void) duk_is_array(ctx, 0);
(void) duk_is_boolean(ctx, 0);
(void) duk_is_bound_function(ctx, 0);
@ -114,8 +125,10 @@ static duk_ret_t test_func(duk_context *ctx) {
(void) duk_is_constructor_call(ctx);
(void) duk_is_dynamic_buffer(ctx, 0);
(void) duk_is_ecmascript_function(ctx, 0);
(void) duk_is_error(ctx, 0);
(void) duk_is_fixed_buffer(ctx, 0);
(void) duk_is_function(ctx, 0);
(void) duk_is_lightfunc(ctx, 0);
(void) duk_is_nan(ctx, 0);
(void) duk_is_null_or_undefined(ctx, 0);
(void) duk_is_null(ctx, 0);
@ -132,6 +145,9 @@ static duk_ret_t test_func(duk_context *ctx) {
(void) duk_join(ctx, 0);
(void) duk_json_decode(ctx, 0);
(void) duk_json_encode(ctx, 0);
(void) duk_load_function(ctx);
(void) duk_log_va(ctx, 0, NULL, NULL);
(void) duk_log(ctx, 0, NULL);
(void) duk_map_string(ctx, 0, NULL, NULL);
(void) duk_new(ctx, 0);
(void) duk_next(ctx, 0, 0);
@ -153,24 +169,30 @@ static duk_ret_t test_func(duk_context *ctx) {
(void) duk_peval_string_noresult(ctx, "dummy");
(void) duk_peval_string(ctx, "dummy");
(void) duk_peval(ctx);
(void) duk_pnew(ctx, 0);
(void) duk_pop_2(ctx);
(void) duk_pop_3(ctx);
(void) duk_pop_n(ctx, 0);
(void) duk_pop(ctx);
(void) duk_push_array(ctx);
(void) duk_push_boolean(ctx, 0);
(void) duk_push_buffer_object(ctx, 0, 0, 0, 0);
(void) duk_push_buffer(ctx, 0, 0);
(void) duk_push_c_function(ctx, NULL, 0);
(void) duk_push_c_lightfunc(ctx, NULL, 0, 0, 0);
(void) duk_push_context_dump(ctx);
(void) duk_push_current_function(ctx);
(void) duk_push_current_thread(ctx);
(void) duk_push_dynamic_buffer(ctx, 0);
(void) duk_push_error_object_va(ctx, 0, NULL, NULL);
(void) duk_push_error_object(ctx, 0, "dummy");
(void) duk_push_external_buffer(ctx);
(void) duk_push_false(ctx);
(void) duk_push_fixed_buffer(ctx, 0);
(void) duk_push_global_object(ctx);
(void) duk_push_global_stash(ctx);
(void) duk_push_heap_stash(ctx);
(void) duk_push_heapptr(ctx, NULL);
(void) duk_push_int(ctx, 0);
(void) duk_push_lstring(ctx, "dummy", 0);
(void) duk_push_nan(ctx);
@ -190,6 +212,7 @@ static duk_ret_t test_func(duk_context *ctx) {
(void) duk_push_undefined(ctx);
(void) duk_push_vsprintf(ctx, "dummy", NULL);
(void) duk_put_function_list(ctx, 0, NULL);
(void) duk_put_global_string(ctx, NULL);
(void) duk_put_number_list(ctx, 0, NULL);
(void) duk_put_prop_index(ctx, 0, 0);
(void) duk_put_prop_string(ctx, 0, "dummy");
@ -200,9 +223,11 @@ static duk_ret_t test_func(duk_context *ctx) {
(void) duk_remove(ctx, 0);
(void) duk_replace(ctx, 0);
(void) duk_require_boolean(ctx, 0);
(void) duk_require_buffer_data(ctx, 0, NULL);
(void) duk_require_buffer(ctx, 0, NULL);
(void) duk_require_c_function(ctx, 0);
(void) duk_require_context(ctx, 0);
(void) duk_require_heapptr(ctx, 0);
(void) duk_require_int(ctx, 0);
(void) duk_require_lstring(ctx, 0, NULL);
(void) duk_require_normalize_index(ctx, 0);
@ -227,6 +252,7 @@ static duk_ret_t test_func(duk_context *ctx) {
(void) duk_set_magic(ctx, 0, 0);
(void) duk_set_prototype(ctx, 0);
(void) duk_set_top(ctx, 0);
(void) duk_steal_buffer(ctx, 0, NULL);
(void) duk_strict_equals(ctx, 0, 0);
(void) duk_substring(ctx, 0, 0, 0);
(void) duk_swap_top(ctx, 0);

21
tests/ecmascript/test-bi-global-parseint.js

@ -417,12 +417,12 @@ try {
/*===
leading zeroes
123
123
-123
129
129
-129
83
83
-83
10
10
-10
57005
57005
-57005
@ -435,20 +435,19 @@ leading zeroes
*
* Note that V8 and Rhino use a leading zero (not followed by 'x' or 'X') to
* indicate an automatic radix 8 (octal). This doesn't seem spec compliant,
* so test against this for now.
* but Duktape now behaves the same way for code compatibility.
*/
/* XXX: change Duktape behavior to match V8 and Rhino for octal? */
print('leading zeroes');
function leadingZeroTest() {
// V8 will yield +/- 83 for this
// V8 will yield +/- 83 for this; standard is +/- 123
print(g.parseInt('000123'));
print(g.parseInt('+000123'));
print(g.parseInt('-000123'));
// V8 will yield +/- 10 for this (012 = 10 octal, 9 is garbage)
// V8 will yield +/- 10 for this (012 = 10 octal, 9 is garbage),
// standard is +/- 129
print(g.parseInt('000129'));
print(g.parseInt('+000129'));
print(g.parseInt('-000129'));

2
website/guide/performance.html

@ -10,6 +10,6 @@ languages. However, up to Duktape 1.1 there has been very little performance
work and Duktape is significantly slower than e.g. Lua right now. Performance
work has been scheduled for spring 2015.</p>
<p>See <a href="http://wiki.duktape.org/HowtoPerformance.html">How to optimize performance</a>
<p>See <a href="http://wiki.duktape.org/Performance.html">How to optimize performance</a>
for discussion of Duktape performance characteristics and hints to optimize code
for performance.</p>

Loading…
Cancel
Save