Add fail tests. Fix parser.
This commit is contained in:
@@ -25,6 +25,7 @@ nbproject
|
|||||||
*.swp
|
*.swp
|
||||||
*~
|
*~
|
||||||
js.files
|
js.files
|
||||||
|
js.fail.files
|
||||||
jerry.error
|
jerry.error
|
||||||
jerry.passed
|
jerry.passed
|
||||||
core
|
core
|
||||||
|
|||||||
+18
@@ -88,6 +88,9 @@ else
|
|||||||
OPTION_TODO := disable
|
OPTION_TODO := disable
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Parser error code
|
||||||
|
PARSER_ERROR_CODE := 255
|
||||||
|
|
||||||
ifeq ($(fixme),1)
|
ifeq ($(fixme),1)
|
||||||
OPTION_FIXME := enable
|
OPTION_FIXME := enable
|
||||||
else
|
else
|
||||||
@@ -514,6 +517,21 @@ $(CHECK_TARGETS):
|
|||||||
fi; \
|
fi; \
|
||||||
\
|
\
|
||||||
exit $$status_code; \
|
exit $$status_code; \
|
||||||
|
fi; \
|
||||||
|
if [ -d $(TESTS_DIR)/fail/ ]; \
|
||||||
|
then \
|
||||||
|
VALGRIND=$(VALGRIND_CMD) TIMEOUT=$(VALGRIND_TIMEOUT) ./tools/jerry_test_fail.sh $(TARGET_DIR)/$(ENGINE_NAME) $(TARGET_DIR)/check $(PARSER_ERROR_CODE) $(TESTS_DIR) $(TESTS_OPTS) $$ADD_OPTS; \
|
||||||
|
status_code=$$?; \
|
||||||
|
if [ $$status_code -ne 0 ]; \
|
||||||
|
then \
|
||||||
|
echo $(TARGET) failed; \
|
||||||
|
if [ "$(OUTPUT_TO_LOG)" = "enable" ]; \
|
||||||
|
then \
|
||||||
|
echo See log in $(TARGET_DIR)/check directory for details.; \
|
||||||
|
fi; \
|
||||||
|
\
|
||||||
|
exit $$status_code; \
|
||||||
|
fi; \
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+72
-28
@@ -878,22 +878,47 @@ cleanup:
|
|||||||
STACK_CHECK_USAGE (IDX);
|
STACK_CHECK_USAGE (IDX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
emit_error_on_eval_and_arguments (idx_t id)
|
||||||
|
{
|
||||||
|
if (id < lexer_get_strings_count ())
|
||||||
|
{
|
||||||
|
if (lp_string_equal_zt (lexer_get_string_by_id (id),
|
||||||
|
ecma_get_magic_string_zt (ECMA_MAGIC_STRING_ARGUMENTS))
|
||||||
|
|| lp_string_equal_zt (lexer_get_string_by_id (id),
|
||||||
|
ecma_get_magic_string_zt (ECMA_MAGIC_STRING_EVAL)))
|
||||||
|
{
|
||||||
|
EMIT_ERROR ("'eval' and 'arguments' are not allowed here in strict mode");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_for_eval_and_arguments_in_strict_mode (idx_t id)
|
check_for_eval_and_arguments_in_strict_mode (idx_t id)
|
||||||
{
|
{
|
||||||
if (parser_strict_mode ())
|
if (parser_strict_mode ())
|
||||||
{
|
{
|
||||||
if (id < lexer_get_strings_count ())
|
emit_error_on_eval_and_arguments (id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
find_assignment_to (opcode_counter_t from, idx_t tmp_id, opcode_t *res)
|
||||||
|
{
|
||||||
|
JERRY_ASSERT (res != NULL);
|
||||||
|
JERRY_ASSERT (tmp_id >= lexer_get_reserved_ids_count ());
|
||||||
|
for (opcode_counter_t oc = from; oc > 0; oc = (opcode_counter_t) (oc - 1))
|
||||||
|
{
|
||||||
|
*res = deserialize_opcode (oc);
|
||||||
|
if (OPCODE_IS ((*res), assignment))
|
||||||
{
|
{
|
||||||
if (lp_string_equal_zt (lexer_get_string_by_id (id),
|
if (res->data.assignment.var_left == tmp_id)
|
||||||
ecma_get_magic_string_zt (ECMA_MAGIC_STRING_ARGUMENTS))
|
|
||||||
|| lp_string_equal_zt (lexer_get_string_by_id (id),
|
|
||||||
ecma_get_magic_string_zt (ECMA_MAGIC_STRING_EVAL)))
|
|
||||||
{
|
{
|
||||||
EMIT_ERROR ("'eval' and 'arguments' are not allowed here in strict mode");
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -908,9 +933,9 @@ check_for_duplication_of_param (opcode_counter_t from, uint8_t metas_num)
|
|||||||
STACK_DECLARE_USAGE (U8);
|
STACK_DECLARE_USAGE (U8);
|
||||||
STACK_DECLARE_USAGE (ops);
|
STACK_DECLARE_USAGE (ops);
|
||||||
|
|
||||||
|
STACK_PUSH (U8, 0); // seen metas
|
||||||
STACK_PUSH (U8, STACK_SIZE (IDX));
|
STACK_PUSH (U8, STACK_SIZE (IDX));
|
||||||
|
|
||||||
uint8_t seen_metas = 0;
|
|
||||||
for (opcode_counter_t oc = from; oc < OPCODE_COUNTER (); oc = (opcode_counter_t) (oc + 1))
|
for (opcode_counter_t oc = from; oc < OPCODE_COUNTER (); oc = (opcode_counter_t) (oc + 1))
|
||||||
{
|
{
|
||||||
STACK_PUSH (ops, deserialize_opcode (oc));
|
STACK_PUSH (ops, deserialize_opcode (oc));
|
||||||
@@ -919,41 +944,58 @@ check_for_duplication_of_param (opcode_counter_t from, uint8_t metas_num)
|
|||||||
switch (STACK_TOP (ops).data.meta.type)
|
switch (STACK_TOP (ops).data.meta.type)
|
||||||
{
|
{
|
||||||
case OPCODE_META_TYPE_VARG:
|
case OPCODE_META_TYPE_VARG:
|
||||||
case OPCODE_META_TYPE_VARG_PROP_DATA:
|
|
||||||
{
|
{
|
||||||
for (uint8_t i = STACK_TOP (U8); i < STACK_SIZE (IDX); i = (uint8_t) (i + 1))
|
for (uint8_t i = STACK_TOP (U8); i < STACK_SIZE (IDX); i = (uint8_t) (i + 1))
|
||||||
{
|
{
|
||||||
if (i == STACK_TOP (ops).data.meta.data_1)
|
if (STACK_ELEMENT (IDX, i) == STACK_TOP (ops).data.meta.data_1)
|
||||||
{
|
{
|
||||||
JERRY_ASSERT (i < lexer_get_strings_count ());
|
JERRY_ASSERT (STACK_ELEMENT (IDX, i) < lexer_get_strings_count ());
|
||||||
EMIT_ERROR_VARG ("Duplication of identifier '%s' as parameter is not allowed in strict mode.",
|
EMIT_ERROR ("Duplication of identifier as parameter is not allowed in strict mode.");
|
||||||
lexer_get_string_by_id (i));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* FALLTHRU. */
|
STACK_PUSH (IDX, STACK_TOP (ops).data.meta.data_1);
|
||||||
|
STACK_INCR_HEAD (U8, 2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case OPCODE_META_TYPE_VARG_PROP_DATA:
|
||||||
|
{
|
||||||
|
opcode_t res;
|
||||||
|
if (find_assignment_to (oc, STACK_TOP (ops).data.meta.data_1, &res))
|
||||||
|
{
|
||||||
|
for (uint8_t i = STACK_TOP (U8); i < STACK_SIZE (IDX); i = (uint8_t) (i + 1))
|
||||||
|
{
|
||||||
|
if (STACK_ELEMENT (IDX, i) == res.data.assignment.value_right)
|
||||||
|
{
|
||||||
|
JERRY_ASSERT (STACK_ELEMENT (IDX, i) < lexer_get_strings_count ());
|
||||||
|
EMIT_ERROR ("Duplication of identifier as parameter is not allowed in strict mode.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
STACK_PUSH (IDX, res.data.assignment.value_right);
|
||||||
|
}
|
||||||
|
/* FALLTHRU. */
|
||||||
}
|
}
|
||||||
case OPCODE_META_TYPE_THIS_ARG:
|
case OPCODE_META_TYPE_THIS_ARG:
|
||||||
case OPCODE_META_TYPE_VARG_PROP_GETTER:
|
case OPCODE_META_TYPE_VARG_PROP_GETTER:
|
||||||
case OPCODE_META_TYPE_VARG_PROP_SETTER:
|
case OPCODE_META_TYPE_VARG_PROP_SETTER:
|
||||||
{
|
{
|
||||||
seen_metas = (uint8_t) (seen_metas + 1);
|
STACK_INCR_HEAD (U8, 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
JERRY_UNREACHABLE ();
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
STACK_DROP (ops, 1);
|
STACK_DROP (ops, 1);
|
||||||
if (seen_metas == metas_num)
|
if (STACK_HEAD (U8, 2) == metas_num)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
STACK_DROP (IDX, STACK_SIZE (IDX) - STACK_TOP (U8));
|
STACK_DROP (IDX, STACK_SIZE (IDX) - STACK_TOP (U8));
|
||||||
STACK_DROP (U8, 1);
|
STACK_DROP (U8, 2);
|
||||||
|
|
||||||
STACK_CHECK_USAGE (ops);
|
STACK_CHECK_USAGE (ops);
|
||||||
STACK_CHECK_USAGE (U8);
|
STACK_CHECK_USAGE (U8);
|
||||||
@@ -1181,6 +1223,7 @@ next:
|
|||||||
}
|
}
|
||||||
case AL_OBJ_DECL:
|
case AL_OBJ_DECL:
|
||||||
{
|
{
|
||||||
|
check_for_duplication_of_param (STACK_TOP (U16), STACK_TOP (U8));
|
||||||
REWRITE_OPCODE_2 (STACK_TOP (U16), obj_decl, ID(1), STACK_TOP (U8));
|
REWRITE_OPCODE_2 (STACK_TOP (U16), obj_decl, ID(1), STACK_TOP (U8));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1231,10 +1274,6 @@ parse_function_declaration (void)
|
|||||||
STACK_DECLARE_USAGE (scopes)
|
STACK_DECLARE_USAGE (scopes)
|
||||||
STACK_DECLARE_USAGE (U8)
|
STACK_DECLARE_USAGE (U8)
|
||||||
|
|
||||||
SET_OPCODE_COUNTER (0);
|
|
||||||
STACK_PUSH (scopes, scopes_tree_init (STACK_TOP (scopes)));
|
|
||||||
serializer_set_scope (STACK_TOP (scopes));
|
|
||||||
|
|
||||||
assert_keyword (KW_FUNCTION);
|
assert_keyword (KW_FUNCTION);
|
||||||
|
|
||||||
token_after_newlines_must_be (TOK_NAME);
|
token_after_newlines_must_be (TOK_NAME);
|
||||||
@@ -1242,7 +1281,12 @@ parse_function_declaration (void)
|
|||||||
STACK_PUSH (IDX, token_data ());
|
STACK_PUSH (IDX, token_data ());
|
||||||
|
|
||||||
skip_newlines ();
|
skip_newlines ();
|
||||||
|
SET_OPCODE_COUNTER (0);
|
||||||
|
STACK_PUSH (scopes, scopes_tree_init (STACK_TOP (scopes)));
|
||||||
|
serializer_set_scope (STACK_TOP (scopes));
|
||||||
|
scopes_tree_set_strict_mode (STACK_TOP (scopes), scopes_tree_strict_mode (STACK_HEAD (scopes, 2)));
|
||||||
STACK_PUSH (U8, parse_argument_list (AL_FUNC_DECL, ID(1)));
|
STACK_PUSH (U8, parse_argument_list (AL_FUNC_DECL, ID(1)));
|
||||||
|
scopes_tree_set_strict_mode (STACK_TOP (scopes), false);
|
||||||
|
|
||||||
STACK_PUSH (U16, OPCODE_COUNTER ());
|
STACK_PUSH (U16, OPCODE_COUNTER ());
|
||||||
DUMP_OPCODE_3 (meta, OPCODE_META_TYPE_UNDEFINED, INVALID_VALUE, INVALID_VALUE);
|
DUMP_OPCODE_3 (meta, OPCODE_META_TYPE_UNDEFINED, INVALID_VALUE, INVALID_VALUE);
|
||||||
@@ -3778,16 +3822,16 @@ preparse_scope (bool is_global)
|
|||||||
STACK_PUSH (U8, is_global ? TOK_EOF : TOK_CLOSE_BRACE);
|
STACK_PUSH (U8, is_global ? TOK_EOF : TOK_CLOSE_BRACE);
|
||||||
|
|
||||||
STACK_PUSH (U16, OPCODE_COUNTER ());
|
STACK_PUSH (U16, OPCODE_COUNTER ());
|
||||||
DUMP_VOID_OPCODE (nop); /* use strict. */
|
|
||||||
|
if (token_is (TOK_STRING) && lp_string_equal_s (lexer_get_string_by_id (token_data ()), "use strict"))
|
||||||
|
{
|
||||||
|
scopes_tree_set_strict_mode (STACK_TOP (scopes), true);
|
||||||
|
DUMP_OPCODE_3 (meta, OPCODE_META_TYPE_STRICT_CODE, INVALID_VALUE, INVALID_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
while (!token_is (STACK_TOP (U8)))
|
while (!token_is (STACK_TOP (U8)))
|
||||||
{
|
{
|
||||||
if (token_is (TOK_STRING) && lp_string_equal_s (lexer_get_string_by_id (token_data ()), "use strict"))
|
if (is_keyword (KW_VAR))
|
||||||
{
|
|
||||||
scopes_tree_set_strict_mode (STACK_TOP (scopes), true);
|
|
||||||
REWRITE_OPCODE_3 (STACK_TOP (U16), meta, OPCODE_META_TYPE_STRICT_CODE, INVALID_VALUE, INVALID_VALUE);
|
|
||||||
}
|
|
||||||
else if (is_keyword (KW_VAR))
|
|
||||||
{
|
{
|
||||||
preparse_var_decls ();
|
preparse_var_decls ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
arguments = 1;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
try{}catch(arguments){};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
var a = { set a(arguments) {} };
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
var arguments;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
function f(arguments) {}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
arguments++;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
++arguments;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
delete a;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
eval = 1;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
try{}catch(eval){};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
var a = { set a(eval) {} };
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
var eval;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
function f(eval) {}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
eval++;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
++eval;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
var let = 1;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
var a = {a:1, a:2};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
var a = 07;
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
function f(a, a) {}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
// Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
"use strict"
|
||||||
|
|
||||||
|
with (Array) {}
|
||||||
@@ -39,12 +39,11 @@ main( int __unused argc,
|
|||||||
|
|
||||||
if (!opcodes_equal(deserialize_bytecode (), (opcode_t[]) {
|
if (!opcodes_equal(deserialize_bytecode (), (opcode_t[]) {
|
||||||
[0] = getop_reg_var_decl (1, 2), // var tmp1 .. tmp2;
|
[0] = getop_reg_var_decl (1, 2), // var tmp1 .. tmp2;
|
||||||
[1] = getop_nop (), // ;
|
[1] = getop_var_decl (0), // var a;
|
||||||
[2] = getop_var_decl (0), // var a;
|
[2] = getop_assignment (1, 1, 1), // tmp1 = 1: SMALLINT;
|
||||||
[3] = getop_assignment (1, 1, 1), // tmp1 = 1: SMALLINT;
|
[3] = getop_assignment (0, 4, 1), // a = tmp1: TYPEOF(tmp1);
|
||||||
[4] = getop_assignment (0, 4, 1), // a = tmp1: TYPEOF(tmp1);
|
[4] = getop_exitval (0) // exit 0;
|
||||||
[5] = getop_exitval (0) // exit 0;
|
}, 5))
|
||||||
}, 6))
|
|
||||||
{
|
{
|
||||||
is_ok = false;
|
is_ok = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Executable
+138
@@ -0,0 +1,138 @@
|
|||||||
|
# Copyright 2014 Samsung Electronics Co., Ltd.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TIMEOUT=${TIMEOUT:=5}
|
||||||
|
|
||||||
|
START_DIR=`pwd`
|
||||||
|
|
||||||
|
ENGINE=$START_DIR/$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
OUT_DIR=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
ERROR_CODE=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
TESTS=$START_DIR/$1/fail/$ERROR_CODE
|
||||||
|
shift
|
||||||
|
|
||||||
|
ECHO_PROGRESS=1
|
||||||
|
JERRY_ARGS=
|
||||||
|
while (( "$#" ))
|
||||||
|
do
|
||||||
|
if [ "$1" = "--parse-only" ]
|
||||||
|
then
|
||||||
|
JERRY_ARGS="$JERRY_ARGS $1"
|
||||||
|
fi
|
||||||
|
if [ "$1" = "--output-to-log" ]
|
||||||
|
then
|
||||||
|
exec 1>$OUT_DIR/jerry_test.log
|
||||||
|
ECHO_PROGRESS=0
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -x $ENGINE ]
|
||||||
|
then
|
||||||
|
echo \"$ENGINE\" is not an executable file
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d $OUT_DIR ]
|
||||||
|
then
|
||||||
|
mkdir -p $OUT_DIR
|
||||||
|
fi
|
||||||
|
cd $OUT_DIR
|
||||||
|
|
||||||
|
JS_FILES=js.fail.files
|
||||||
|
JERRY_ERROR=jerry.error
|
||||||
|
JERRY_OK=jerry.passed
|
||||||
|
|
||||||
|
rm -f $JS_FILES $JERRY_ERROR
|
||||||
|
|
||||||
|
if [ -d $TESTS ];
|
||||||
|
then
|
||||||
|
find $TESTS -name [^N]*.js -print | sort > $JS_FILES
|
||||||
|
else
|
||||||
|
if [ -f $TESTS ];
|
||||||
|
then
|
||||||
|
cp $TESTS $JS_FILES
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi;
|
||||||
|
fi;
|
||||||
|
total=$(cat $JS_FILES | wc -l)
|
||||||
|
|
||||||
|
tested=0
|
||||||
|
failed=0
|
||||||
|
passed=0
|
||||||
|
|
||||||
|
JERRY_TEMP=jerry.tmp
|
||||||
|
|
||||||
|
exec 2>/dev/null
|
||||||
|
|
||||||
|
echo " Passed / Failed / Tested / Total / Percent"
|
||||||
|
|
||||||
|
for test in `cat $JS_FILES`
|
||||||
|
do
|
||||||
|
percent=$(echo $tested*100/$total | bc)
|
||||||
|
|
||||||
|
( ulimit -t $TIMEOUT; $VALGRIND ${ENGINE} ${test} ${JERRY_ARGS} >&$JERRY_TEMP; exit $? );
|
||||||
|
status_code=$?
|
||||||
|
|
||||||
|
if [ $ECHO_PROGRESS -eq 1 ]
|
||||||
|
then
|
||||||
|
printf "\r\e[2K[ %6d / %6d / %6d / %5d / %3d%% ]" ${passed} ${failed} ${tested} ${total} ${percent}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $status_code -ne $ERROR_CODE ]
|
||||||
|
then
|
||||||
|
echo "$status_code: ${test}" >> $JERRY_ERROR
|
||||||
|
echo "============================================" >> $JERRY_ERROR
|
||||||
|
cat $JERRY_TEMP >> $JERRY_ERROR
|
||||||
|
echo "============================================" >> $JERRY_ERROR
|
||||||
|
echo >> $JERRY_ERROR
|
||||||
|
echo >> $JERRY_ERROR
|
||||||
|
|
||||||
|
failed=$((failed+1))
|
||||||
|
else
|
||||||
|
echo "${test}" >> $JERRY_OK
|
||||||
|
passed=$((passed+1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
tested=$((tested+1))
|
||||||
|
done
|
||||||
|
|
||||||
|
rm $JERRY_TEMP
|
||||||
|
|
||||||
|
printf "\r\e[2K[ %6d / %6d / %6d / %5d / %3d%% ]\n" ${passed} ${failed} ${tested} ${total} ${percent}
|
||||||
|
|
||||||
|
ratio=$(echo $passed*100/$total | bc)
|
||||||
|
|
||||||
|
echo ==========================
|
||||||
|
echo "Number of tests passed: ${passed}"
|
||||||
|
echo "Number of tests failed: ${failed}"
|
||||||
|
echo --------------------------
|
||||||
|
echo "Total number of tests: ${total}"
|
||||||
|
echo "Passed: ${ratio}%"
|
||||||
|
|
||||||
|
if [ ${failed} -ne 0 ]
|
||||||
|
then
|
||||||
|
echo "See $JERRY_ERROR for details about failures"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
Reference in New Issue
Block a user