Bump reference platform to Ubuntu 18.04 LTS (#3037)

Ubuntu 14.04 reached its end of life on April 30m 2019.
Let's bump the reference to the latest LTS, which is 18.04.

Ubuntu 18.04 has newer Pylint and Cppcheck, the necessary
fixes and suppresses are also included in this PR.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
This commit is contained in:
Csaba Osztrogonác
2020-03-30 12:26:56 +02:00
committed by GitHub
parent c237ba6097
commit 1bd1a36a81
25 changed files with 62 additions and 38 deletions
+5 -8
View File
@@ -1,8 +1,8 @@
language: c language: c
# Default environment: Ubuntu Trusty 14.04. # Default environment: Ubuntu Bionic 18.04.
os: linux os: linux
dist: trusty dist: bionic
# Default job task: run tests as defined in the $OPT environment variable. # Default job task: run tests as defined in the $OPT environment variable.
# Jobs can redefine the 'script' stage in the matrix below. # Jobs can redefine the 'script' stage in the matrix below.
@@ -12,13 +12,12 @@ script: tools/run-tests.py $OPTS
matrix: matrix:
include: include:
- name: "Checks" - name: "Checks"
install: pip install --user pylint==1.6.5
script: script:
- tools/run-tests.py --check-signed-off=travis --check-doxygen --check-vera --check-license --check-magic-strings --check-pylint - tools/run-tests.py --check-signed-off=travis --check-doxygen --check-vera --check-license --check-magic-strings --check-pylint
- travis_wait 40 tools/run-tests.py --check-cppcheck - travis_wait 40 tools/run-tests.py --check-cppcheck
addons: addons:
apt: apt:
packages: [doxygen, cppcheck, vera++] packages: [doxygen, cppcheck, vera++, pylint]
- name: "Linux/x86-64 Build, Correctness & Debugger Tests" - name: "Linux/x86-64 Build, Correctness & Debugger Tests"
env: env:
@@ -70,22 +69,20 @@ matrix:
- OPTS="--quiet --jerry-tests --jerry-test-suite --skip-list=parser-oom.js,parser-oom2.js,stack-limit.js,regression-test-issue-2190.js,regression-test-issue-2258-2963.js,regression-test-issue-2448.js,regression-test-issue-2905.js --buildoptions=--stack-limit=0,--compile-flag=-fsanitize=address,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--compile-flag=-O2,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold" - OPTS="--quiet --jerry-tests --jerry-test-suite --skip-list=parser-oom.js,parser-oom2.js,stack-limit.js,regression-test-issue-2190.js,regression-test-issue-2258-2963.js,regression-test-issue-2448.js,regression-test-issue-2905.js --buildoptions=--stack-limit=0,--compile-flag=-fsanitize=address,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--compile-flag=-O2,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold"
- ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=true:strict_init_order=true - ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=true:strict_init_order=true
- TIMEOUT=600 - TIMEOUT=600
compiler: gcc-5
addons: addons:
apt: apt:
sources: ubuntu-toolchain-r-test sources: ubuntu-toolchain-r-test
packages: [gcc-5, gcc-5-multilib] packages: [gcc-multilib]
- name: "UBSAN Tests" - name: "UBSAN Tests"
env: env:
- OPTS="--quiet --jerry-tests --jerry-test-suite --skip-list=parser-oom.js,parser-oom2.js --buildoptions=--compile-flag=-fsanitize=undefined,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold" - OPTS="--quiet --jerry-tests --jerry-test-suite --skip-list=parser-oom.js,parser-oom2.js --buildoptions=--compile-flag=-fsanitize=undefined,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold"
- UBSAN_OPTIONS=print_stacktrace=1 - UBSAN_OPTIONS=print_stacktrace=1
- TIMEOUT=600 - TIMEOUT=600
compiler: gcc-5
addons: addons:
apt: apt:
sources: ubuntu-toolchain-r-test sources: ubuntu-toolchain-r-test
packages: [gcc-5, gcc-5-multilib] packages: [gcc-multilib]
- name: "Coverity Scan & SonarQube" - name: "Coverity Scan & SonarQube"
env: env:
+1 -1
View File
@@ -1,6 +1,6 @@
## Setting up prerequisites ## Setting up prerequisites
Currently, only Ubuntu 14.04+ is officially supported as primary development environment. Currently, only Ubuntu 18.04+ is officially supported as primary development environment.
There are several dependencies, that should be installed manually. The following list is the absolute minimum for building: There are several dependencies, that should be installed manually. The following list is the absolute minimum for building:
+2 -2
View File
@@ -697,7 +697,7 @@ ecma_number_parse_int (const lit_utf8_byte_t *string_buff, /**< routine's first
* string buffer's size */ * string buffer's size */
ecma_value_t radix) /**< routine's second argument */ ecma_value_t radix) /**< routine's second argument */
{ {
if (string_buff_size <= 0) if (string_buff_size == 0)
{ {
return ecma_make_nan_value (); return ecma_make_nan_value ();
} }
@@ -874,7 +874,7 @@ ecma_number_parse_float (const lit_utf8_byte_t *string_buff, /**< routine's firs
lit_utf8_size_t string_buff_size) /**< routine's first argument's lit_utf8_size_t string_buff_size) /**< routine's first argument's
* string buffer's size */ * string buffer's size */
{ {
if (string_buff_size <= 0) if (string_buff_size == 0)
{ {
return ecma_make_nan_value (); return ecma_make_nan_value ();
} }
@@ -40,6 +40,7 @@ JERRY_STATIC_ASSERT (sizeof (jmem_cpointer_t) <= sizeof (jmem_cpointer_tag_t),
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY #ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
/* cppcheck-suppress zerodiv */
JERRY_STATIC_ASSERT (sizeof (uintptr_t) <= sizeof (ecma_value_t), JERRY_STATIC_ASSERT (sizeof (uintptr_t) <= sizeof (ecma_value_t),
uintptr_t_must_fit_in_ecma_value_t); uintptr_t_must_fit_in_ecma_value_t);
@@ -349,6 +349,7 @@ ecma_instantiate_builtin (ecma_builtin_id_t obj_builtin_id) /**< built-in id */
ecma_object_t *prototype_obj_p; ecma_object_t *prototype_obj_p;
/* cppcheck-suppress arrayIndexOutOfBoundsCond */
if (JERRY_UNLIKELY (object_prototype_builtin_id == ECMA_BUILTIN_ID__COUNT)) if (JERRY_UNLIKELY (object_prototype_builtin_id == ECMA_BUILTIN_ID__COUNT))
{ {
prototype_obj_p = NULL; prototype_obj_p = NULL;
@@ -1296,7 +1296,9 @@ ecma_op_lazy_instantiate_prototype_object (ecma_object_t *object_p) /**< the fun
} }
#endif /* ENABLED (JERRY_ES2015) */ #endif /* ENABLED (JERRY_ES2015) */
#if ENABLED (JERRY_ES2015)
if (proto_object_p == NULL) if (proto_object_p == NULL)
#endif /* ENABLED (JERRY_ES2015) */
{ {
proto_object_p = ecma_op_create_object_object_noarg (); proto_object_p = ecma_op_create_object_object_noarg ();
} }
+1
View File
@@ -288,6 +288,7 @@ jmem_heap_gc_and_alloc_block (const size_t size, /**< required memory size */
void *data_space_p = jmem_heap_alloc (size); void *data_space_p = jmem_heap_alloc (size);
/* cppcheck-suppress memleak */
while (JERRY_UNLIKELY (data_space_p == NULL) && JERRY_LIKELY (pressure < max_pressure)) while (JERRY_UNLIKELY (data_space_p == NULL) && JERRY_LIKELY (pressure < max_pressure))
{ {
pressure++; pressure++;
+1 -1
View File
@@ -252,7 +252,7 @@ def src_check_args(args):
print("Error: Non-negative integer number expected: %s" % (val_errno)) print("Error: Non-negative integer number expected: %s" % (val_errno))
return -1 return -1
# pylint: disable=too-many-branches,too-many-locals,too-many-statements,redefined-variable-type # pylint: disable=too-many-branches,too-many-locals,too-many-statements
def main(): def main():
args = jerry_client_main.arguments_parse() args = jerry_client_main.arguments_parse()
+2 -2
View File
@@ -267,7 +267,7 @@ class DebuggerAction(object):
class JerryDebugger(object): class JerryDebugger(object):
# pylint: disable=too-many-instance-attributes,too-many-statements,too-many-public-methods,no-self-use,redefined-variable-type # pylint: disable=too-many-instance-attributes,too-many-statements,too-many-public-methods,no-self-use
def __init__(self, channel): def __init__(self, channel):
self.prompt = False self.prompt = False
self.function_list = {} self.function_list = {}
@@ -490,7 +490,7 @@ class JerryDebugger(object):
index = int(args) index = int(args)
if index < 0: if index < 0:
print ("Error: A non negative integer number expected") print ("Error: A non negative integer number expected")
return return ""
except ValueError as val_errno: except ValueError as val_errno:
return "Error: Non negative integer number expected, %s\n" % (val_errno) return "Error: Non negative integer number expected, %s\n" % (val_errno)
+13 -4
View File
@@ -63,7 +63,13 @@ jerryx_set_properties (const jerry_value_t target_object, /**< target object */
{ {
#define JERRYX_SET_PROPERTIES_RESULT(VALUE, IDX) ((jerryx_register_result) { VALUE, IDX }) #define JERRYX_SET_PROPERTIES_RESULT(VALUE, IDX) ((jerryx_register_result) { VALUE, IDX })
uint32_t idx = 0; uint32_t idx = 0;
for (; ((entries + idx) != NULL) && (entries[idx].name != NULL); idx++)
if (entries == NULL)
{
return JERRYX_SET_PROPERTIES_RESULT (jerry_create_undefined (), 0);
}
for (; (entries[idx].name != NULL); idx++)
{ {
const jerryx_property_entry *entry = &entries[idx]; const jerryx_property_entry *entry = &entries[idx];
@@ -99,9 +105,12 @@ void
jerryx_release_property_entry (const jerryx_property_entry entries[], /**< list of property entries */ jerryx_release_property_entry (const jerryx_property_entry entries[], /**< list of property entries */
const jerryx_register_result register_result) /**< previous result of registration */ const jerryx_register_result register_result) /**< previous result of registration */
{ {
for (uint32_t idx = register_result.registered; if (entries == NULL)
((entries + idx) != NULL) && (entries[idx].name != NULL); {
idx++) return;
}
for (uint32_t idx = register_result.registered; entries[idx].name != NULL; idx++)
{ {
jerry_release_value (entries[idx].value); jerry_release_value (entries[idx].value);
} }
+1 -1
View File
@@ -88,7 +88,7 @@ acos (double x)
return pi + 2.0 * pio2_lo; return pi + 2.0 * pio2_lo;
} }
} }
return (x - x) / (x - x); /* acos(|x|>1) is NaN */ return NAN; /* acos(|x|>1) is NaN */
} }
if (ix < 0x3fe00000) /* |x| < 0.5 */ if (ix < 0x3fe00000) /* |x| < 0.5 */
{ {
+1 -1
View File
@@ -89,7 +89,7 @@ asin (double x)
{ {
return x * pio2_hi + x * pio2_lo; return x * pio2_hi + x * pio2_lo;
} }
return (x - x) / (x - x); /* asin(|x|>1) is NaN */ return NAN; /* asin(|x|>1) is NaN */
} }
else if (ix < 0x3fe00000) /* |x| < 0.5 */ else if (ix < 0x3fe00000) /* |x| < 0.5 */
{ {
+1 -1
View File
@@ -82,7 +82,7 @@ atan2 (double y, double x)
{ {
return atan (y); return atan (y);
} }
m = ((hy >> 31) & 1) | ((hx >> 30) & 2); /* 2 * sign(x) + sign(y) */ m = ((hy < 0) ? 1 : 0) + ((hx < 0) ? 2 : 0); /* 2 * sign(x) + sign(y) */
/* when y = 0 */ /* when y = 0 */
if ((iy | ly) == 0) if ((iy | ly) == 0)
+1 -1
View File
@@ -197,7 +197,7 @@ exp (double x) /* default IEEE double exp */
} }
if (k >= -1021) if (k >= -1021)
{ {
ret.as_int.hi += (k << 20); /* add k to y's exponent */ ret.as_int.hi += (((unsigned int) k) << 20); /* add k to y's exponent */
return ret.dbl; return ret.dbl;
} }
else else
+3 -3
View File
@@ -53,7 +53,7 @@ fmod (double x, double y)
if ((hy | ly) == 0 || (hx >= 0x7ff00000) || /* y = 0, or x not finite */ if ((hy | ly) == 0 || (hx >= 0x7ff00000) || /* y = 0, or x not finite */
((hy | ((ly | -ly) >> 31)) > 0x7ff00000)) /* or y is NaN */ ((hy | ((ly | -ly) >> 31)) > 0x7ff00000)) /* or y is NaN */
{ {
return (x * y) / (x * y); return NAN;
} }
if (hx <= hy) if (hx <= hy)
{ {
@@ -123,7 +123,7 @@ fmod (double x, double y)
n = -1022 - ix; n = -1022 - ix;
if (n <= 31) if (n <= 31)
{ {
hx = (hx << n) | (lx >> (32 - n)); hx = (((unsigned int) hx) << n) | (lx >> (32 - n));
lx <<= n; lx <<= n;
} }
else else
@@ -141,7 +141,7 @@ fmod (double x, double y)
n = -1022 - iy; n = -1022 - iy;
if (n <= 31) if (n <= 31)
{ {
hy = (hy << n) | (ly >> (32 - n)); hy = (((unsigned int) hy) << n) | (ly >> (32 - n));
ly <<= n; ly <<= n;
} }
else else
+2 -2
View File
@@ -254,12 +254,12 @@ pow (double x, double y)
} }
} }
n = (hx >> 31) + 1; n = (hx < 0) ? 0 : 1;
/* (x<0)**(non-int) is NaN */ /* (x<0)**(non-int) is NaN */
if ((n | yisint) == 0) if ((n | yisint) == 0)
{ {
return (x - x) / (x - x); return NAN;
} }
s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
+1 -1
View File
@@ -125,7 +125,7 @@ sqrt (double x)
} }
else if (ix0 < 0) /* sqrt(-ve) = sNaN */ else if (ix0 < 0) /* sqrt(-ve) = sNaN */
{ {
return (x - x) / (x - x); return NAN;
} }
} }
/* normalize x */ /* normalize x */
+1 -1
View File
@@ -112,7 +112,7 @@ cli_consume_option (cli_state_t *state_p) /**< state of the command line option
state_p->arg = arg; state_p->arg = arg;
if (arg[0] != '-' || (arg[0] == '-' && arg[1] == '\0')) if (arg[0] != '-' || arg[1] == '\0')
{ {
return CLI_OPT_DEFAULT; return CLI_OPT_DEFAULT;
} }
+5 -5
View File
@@ -150,7 +150,7 @@ read_file (uint8_t *input_pos_p, /**< next position in the input buffer */
return 0; return 0;
} }
printf ("Input file '%s' (%lu bytes) loaded.\n", file_name, bytes_read); printf ("Input file '%s' (%zu bytes) loaded.\n", file_name, bytes_read);
return bytes_read; return bytes_read;
} /* read_file */ } /* read_file */
@@ -426,7 +426,7 @@ process_generate (cli_state_t *cli_state_p, /**< cli state */
fwrite (output_buffer, sizeof (uint8_t), snapshot_size, snapshot_file_p); fwrite (output_buffer, sizeof (uint8_t), snapshot_size, snapshot_file_p);
fclose (snapshot_file_p); fclose (snapshot_file_p);
printf ("Created snapshot file: '%s' (%lu bytes)\n", output_file_name_p, (unsigned long) snapshot_size); printf ("Created snapshot file: '%s' (%zu bytes)\n", output_file_name_p, snapshot_size);
jerry_cleanup (); jerry_cleanup ();
return JERRY_STANDALONE_EXIT_CODE_OK; return JERRY_STANDALONE_EXIT_CODE_OK;
@@ -584,7 +584,7 @@ process_literal_dump (cli_state_t *cli_state_p, /**< cli state */
return JERRY_STANDALONE_EXIT_CODE_FAIL; return JERRY_STANDALONE_EXIT_CODE_FAIL;
} }
printf ("Successfully merged the input snapshots (%lu bytes).\n", merged_snapshot_size); printf ("Successfully merged the input snapshots (%zu bytes).\n", merged_snapshot_size);
lit_buf_sz = jerry_get_literals_from_snapshot (output_buffer, lit_buf_sz = jerry_get_literals_from_snapshot (output_buffer,
merged_snapshot_size, merged_snapshot_size,
@@ -618,7 +618,7 @@ process_literal_dump (cli_state_t *cli_state_p, /**< cli state */
fwrite (literal_buffer, sizeof (uint8_t), lit_buf_sz, file_p); fwrite (literal_buffer, sizeof (uint8_t), lit_buf_sz, file_p);
fclose (file_p); fclose (file_p);
printf ("Literals are saved into '%s' (%lu bytes).\n", literals_file_name_p, lit_buf_sz); printf ("Literals are saved into '%s' (%zu bytes).\n", literals_file_name_p, lit_buf_sz);
jerry_cleanup (); jerry_cleanup ();
return JERRY_STANDALONE_EXIT_CODE_OK; return JERRY_STANDALONE_EXIT_CODE_OK;
@@ -752,7 +752,7 @@ process_merge (cli_state_t *cli_state_p, /**< cli state */
fwrite (output_buffer, 1u, merged_snapshot_size, file_p); fwrite (output_buffer, 1u, merged_snapshot_size, file_p);
fclose (file_p); fclose (file_p);
printf ("Merge is completed. Merged snapshot is saved into '%s' (%lu bytes).\n", printf ("Merge is completed. Merged snapshot is saved into '%s' (%zu bytes).\n",
output_file_name_p, output_file_name_p,
merged_snapshot_size); merged_snapshot_size);
+6
View File
@@ -53,6 +53,12 @@ static const uint32_t *
read_file (const char *file_name, read_file (const char *file_name,
size_t *out_size_p) size_t *out_size_p)
{ {
if (file_name == NULL)
{
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Error: failed to open file, missing filename\n");
return NULL;
}
FILE *file; FILE *file;
if (!strcmp ("-", file_name)) if (!strcmp ("-", file_name))
{ {
+1
View File
@@ -304,6 +304,7 @@ main (void)
/* Test ArrayBuffer external memory map/unmap */ /* Test ArrayBuffer external memory map/unmap */
{ {
const uint32_t buffer_size = 20; const uint32_t buffer_size = 20;
/* cppcheck-suppress variableScope */
JERRY_VLA (uint8_t, buffer_p, buffer_size); JERRY_VLA (uint8_t, buffer_p, buffer_size);
{ {
jerry_value_t input_buffer = jerry_create_arraybuffer_external (buffer_size, buffer_p, NULL); jerry_value_t input_buffer = jerry_create_arraybuffer_external (buffer_size, buffer_p, NULL);
+2 -2
View File
@@ -155,7 +155,7 @@ test_typedarray_queries (test_entry_t test_entries[]) /**< test cases */
*/ */
static static
void test_buffer_value (uint64_t value, /**< value to test for */ void test_buffer_value (uint64_t value, /**< value to test for */
const uint8_t *buffer, /**< buffer to read value from */ const void *buffer, /**< buffer to read value from */
uint32_t start_offset, /**< start offset of the value */ uint32_t start_offset, /**< start offset of the value */
jerry_typedarray_type_t typedarray_type, /**< type of TypedArray */ jerry_typedarray_type_t typedarray_type, /**< type of TypedArray */
uint32_t bytes_per_element) /**< bytes per element for the given type */ uint32_t bytes_per_element) /**< bytes per element for the given type */
@@ -518,11 +518,11 @@ main (void)
/* Test TypedArray operations in js */ /* Test TypedArray operations in js */
{ {
const uint32_t element_count = 14; const uint32_t element_count = 14;
uint8_t expected_value = 42;
jerry_value_t array = jerry_create_typedarray (JERRY_TYPEDARRAY_UINT8, element_count); jerry_value_t array = jerry_create_typedarray (JERRY_TYPEDARRAY_UINT8, element_count);
{ {
uint8_t expected_value = 42;
JERRY_VLA (uint8_t, expected_data, element_count); JERRY_VLA (uint8_t, expected_data, element_count);
memset (expected_data, expected_value, element_count); memset (expected_data, expected_value, element_count);
+1
View File
@@ -40,6 +40,7 @@ cppcheck -j$CPPCHECK_JOBS --force \
--enable=warning,style,performance,portability,information \ --enable=warning,style,performance,portability,information \
--template="{file}:{line}: {severity}({id}): {message}" \ --template="{file}:{line}: {severity}({id}): {message}" \
--error-exitcode=1 \ --error-exitcode=1 \
--inline-suppr \
--exitcode-suppressions=tools/cppcheck/suppressions-list \ --exitcode-suppressions=tools/cppcheck/suppressions-list \
--suppressions-list=tools/cppcheck/suppressions-list \ --suppressions-list=tools/cppcheck/suppressions-list \
"${INCLUDE_DIRS[@]}" \ "${INCLUDE_DIRS[@]}" \
+6 -1
View File
@@ -1,4 +1,9 @@
wrongmathcall:tests/unit-libm/test-libm.inc.h wrongmathcall:tests/unit-libm/test-libm.inc.h
variableScope:jerry-libm/*.c variableScope:jerry-libm/*.c
invalidPointerCast:jerry-libm/*.c invalidPointerCast:jerry-libm/*.c
commaSeparatedReturn:*
ConfigurationNotChecked:jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h
ConfigurationNotChecked:jerry-core/ecma/builtin-objects/ecma-builtin-helpers-macro-defines.inc.h
ConfigurationNotChecked:jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h
ConfigurationNotChecked:jerry-core/ecma/builtin-objects/ecma-builtin-object.inc.h
ConfigurationNotChecked:jerry-core/ecma/builtin-objects/ecma-builtin-helpers-macro-undefs.inc.h
+1 -1
View File
@@ -301,7 +301,7 @@ def hash_binary(bin_path):
hasher = hashlib.sha1() hasher = hashlib.sha1()
with open(bin_path, 'rb') as bin_file: with open(bin_path, 'rb') as bin_file:
buf = bin_file.read(blocksize) buf = bin_file.read(blocksize)
while len(buf) > 0: while buf:
hasher.update(buf) hasher.update(buf)
buf = bin_file.read(blocksize) buf = bin_file.read(blocksize)
return hasher.hexdigest() return hasher.hexdigest()