diff options
| -rw-r--r-- | Documentation/test-suite | 4 | ||||
| -rw-r--r-- | flow.c | 39 | ||||
| -rw-r--r-- | validation/infinite-loop0.c | 11 | ||||
| -rwxr-xr-x | validation/test-suite | 7 |
4 files changed, 24 insertions, 37 deletions
diff --git a/Documentation/test-suite b/Documentation/test-suite index 2e786bbf..a288c81a 100644 --- a/Documentation/test-suite +++ b/Documentation/test-suite @@ -25,6 +25,10 @@ check-command: (optional) check-exit-value: (optional) The expected exit value of check-command. It defaults to 0. +check-timeout: (optional) + The maximum expected duration of check-command, in seconds. + It defaults to 1. + check-output-start / check-output-end (optional) The expected output (stdout and stderr) of check-command lies between those two tags. It defaults to no output. @@ -650,11 +650,10 @@ void check_access(struct instruction *insn) static void simplify_one_symbol(struct entrypoint *ep, struct symbol *sym) { - pseudo_t pseudo, src; + pseudo_t pseudo; struct pseudo_user *pu; - struct instruction *def; unsigned long mod; - int all, stores, complex; + int all; /* Never used as a symbol? */ pseudo = sym->pseudo; @@ -670,17 +669,12 @@ static void simplify_one_symbol(struct entrypoint *ep, struct symbol *sym) if (mod) goto external_visibility; - def = NULL; - stores = 0; - complex = 0; FOR_EACH_PTR(pseudo->users, pu) { /* We know that the symbol-pseudo use is the "src" in the instruction */ struct instruction *insn = pu->insn; switch (insn->opcode) { case OP_STORE: - stores++; - def = insn; break; case OP_LOAD: break; @@ -697,37 +691,8 @@ static void simplify_one_symbol(struct entrypoint *ep, struct symbol *sym) default: warning(sym->pos, "symbol '%s' pseudo used in unexpected way", show_ident(sym->ident)); } - complex |= insn->offset; } END_FOR_EACH_PTR(pu); - if (complex) - goto complex_def; - if (stores > 1) - goto multi_def; - - /* - * Goodie, we have a single store (if even that) in the whole - * thing. Replace all loads with moves from the pseudo, - * replace the store with a def. - */ - src = VOID; - if (def) - src = def->target; - - FOR_EACH_PTR(pseudo->users, pu) { - struct instruction *insn = pu->insn; - if (insn->opcode == OP_LOAD) { - check_access(insn); - convert_load_instruction(insn, src); - } - } END_FOR_EACH_PTR(pu); - - /* Turn the store into a no-op */ - kill_store(def); - return; - -multi_def: -complex_def: external_visibility: all = 1; FOR_EACH_PTR_REVERSE(pseudo->users, pu) { diff --git a/validation/infinite-loop0.c b/validation/infinite-loop0.c new file mode 100644 index 00000000..0e3e3805 --- /dev/null +++ b/validation/infinite-loop0.c @@ -0,0 +1,11 @@ +void foo(void) +{ + int a = a || 0; + if (a) ; +} + +/* + * check-name: internal infinite loop (0) + * check-command: sparse -Wno-decl $file + * check-timeout: + */ diff --git a/validation/test-suite b/validation/test-suite index 3056fce9..cf151a36 100755 --- a/validation/test-suite +++ b/validation/test-suite @@ -39,6 +39,7 @@ get_tag_value() check_name="" check_command="$default_cmd" check_exit_value=0 + check_timeout=0 check_known_to_fail=0 check_error_ignore=0 check_output_ignore=0 @@ -56,6 +57,8 @@ get_tag_value() check-name:) check_name="$val" ;; check-command:) check_command="$val" ;; check-exit-value:) check_exit_value="$val" ;; + check-timeout:) [ -z "$val" ] && val=1 + check_timeout="$val" ;; check-known-to-fail) check_known_to_fail=1 ;; check-error-ignore) check_error_ignore=1 ;; check-output-ignore) check_output_ignore=1 ;; @@ -211,6 +214,10 @@ do_test() expected_exit_value=$check_exit_value verbose "Expecting exit value: $expected_exit_value" + # do we want a timeout? + if [ $check_timeout -ne 0 ]; then + cmd="timeout -k 1s $check_timeout $cmd" + fi # grab the actual output & exit value $cmd 1> $file.output.got 2> $file.error.got |
