oceani: type error in program - not running.
###### test list
- oceani_failing_tests += type_err_const type_err_const1
+ oceani_failing_tests += type_err_const type_err_const1 missing_program
###### test: type_err_const
const
.tmp.code:3:12: Syntax error in constant: :
.tmp.code:4:12: Syntax error in constant: :
+###### test: missing_program
+ const
+ foo::="bar"
+
+###### output: missing_program
+ oceani: no program found.
+
## Test erroneous command line args
To improve coverage, we want to test correct handling of strange command
exit(1);
}
} else
- ss = s;
+ ss = s; // NOTEST
parse_oceani(ss->code, &context.config, dotrace ? stderr : NULL);
if (!context.prog) {
static void type_print(struct type *type, FILE *f)
{
if (!type)
- fputs("*unknown*type*", f);
+ fputs("*unknown*type*", f); // NOTEST
else if (type->name.len)
fprintf(f, "%.*s", type->name.len, type->name.txt);
else if (type->print_type)
type->init(type, val);
}
- static void dup_value(struct type *type,
+ static void dup_value(struct type *type,
struct value *vold, struct value *vnew)
{
if (type && type->dup)
return tl->cmp_order(tl, tr, left, right);
if (tl && tl->cmp_eq)
return tl->cmp_eq(tl, tr, left, right);
- return -1;
+ return -1; // NOTEST
}
static void print_value(struct type *type, struct value *v)
static void _free_value(struct type *type, struct value *v)
{
if (!v)
- return;
+ return; // NOTEST
switch (type->vtype) {
case Vnone: break;
case Vstr: free(v->str.txt); break;
case Vbool:
val->bool = 0;
break;
- case Vlabel: // NOTEST
- val->label = NULL; // NOTEST
- break; // NOTEST
+ case Vlabel:
+ val->label = NULL;
+ break;
}
}
if (primary->merged)
// shouldn't happen
- primary = primary->merged;
+ primary = primary->merged; // NOTEST
for (v = primary->previous; v; v=v->previous)
if (v == secondary || v == secondary->merged ||
if (!c->local || !v->type)
return NULL;
if (v->frame_pos + v->type->size > c->local_size) {
- printf("INVALID frame_pos\n"); // NOTEST
- exit(2);
+ printf("INVALID frame_pos\n"); // NOTEST
+ exit(2); // NOTEST
}
return c->local + v->frame_pos;
}
}
if (loc->type == Xbinode)
return __fput_loc(cast(binode,loc)->left, f) ||
- __fput_loc(cast(binode,loc)->right, f);
- return 0;
+ __fput_loc(cast(binode,loc)->right, f); // NOTEST
+ return 0; // NOTEST
}
static void fput_loc(struct exec *loc, FILE *f)
{
--- /dev/null
+#!/bin/sh
+
+sed -i -e 's, // UNTESTED$,,' $(git grep -l '// UNTESTED$' .)
+
+case $1 in
+ remove )
+ exit 0
+ ;;
+
+ * )
+ rm coverage/*.mdc.gcov
+ make SKIP_VALGRIND=1 oceani_test_suite || exit 1
+ for i in coverage/*.mdc.gcov
+ do
+ b=${i%.gcov}
+ b=${b#coverage/}
+ if [ ! -f "$b" ]; then
+ continue
+ fi
+ grep '#####:' "$i" | grep -vE '(NOTEST|UNTESTED|:######|}\$$|:$|:[ ]*(\||\$))' |
+ awk -F: '{printf "%ds,$, // UNTESTED,\n", $2}' |
+ sed -i -e 's,[ ]*// UNTESTED$,,' -f - "$b"
+ grep '[0-8]: *[1-9][0-9]*:.*// NOTEST$' "$i" |
+ awk -F: '{printf "%ds,[ ]*// NOTEST$,,\n", $2}' |
+ sed -i -f - "$b"
+ grep -c UNTESTED "$b"
+ done
+esac
+