Several fixes for input manager error handling.

- First:
Due to architectural constraints, it is very hard for the
input framework to handle optional records. For an optional record,
either the whole record has to be missing, or all non-optional elements
of the record have to be defined. This information is not available
to input readers after the records have been unrolled into the threading
types.

Behavior so far was to treat optional records like they are non-optional,
without warning. The patch changes this behavior to emit an error on stream-
creation (during type-checking) and refusing to open the file. I think this
is a better idea - the behavior so far was undocumented and unintuitive.

- Second:
For table and event streams, reader backend creation was done very early,
before actually checking if all arguments are valid. Initialization is moved
after the checks now - this makes a number of delete statements unnecessary.
Also - I suspect threads of failed input reader instances were not deleted
until shutdown

- Third:
Add a couple more consistency checks, e.g. checking if the destination value
of a table has the same type as we need. We did not check everything in all
instances, instead we just assigned the things without caring (which works,
but is not really desirable).

This change also exposed a few bugs in other testcases where table definitions
were wrong (did not respect $want_record)

- Fourth:
Improve error messages and write testcases for all error messages (I think).
This commit is contained in:
Bernhard Amann 2013-12-05 15:04:28 -08:00
parent 574018f478
commit 3c59aa9459
8 changed files with 320 additions and 79 deletions

View file

@ -0,0 +1,36 @@
error: Incompatible type "file" in type definition for for field "s" in ReaderFrontend
error: Input stream file: Problem unrolling
The input framework does not support optional record fields: "r"
error: Input stream optionalrecord: Problem unrolling
Encountered incompatible type "file" in type definition for field "s" in ReaderFrontend. Ignoring optional field.
error: Incompatible type "file" in type definition for for field "s" in ReaderFrontend
error: Input stream filetable: Problem unrolling
The input framework does not support optional record fields: "r"
error: Input stream optionalrecordtable: Problem unrolling
Encountered incompatible type "file" in type definition for field "s" in ReaderFrontend. Ignoring optional field.
error: Input stream optionalfiletable: Table type does not match value type. Need type 'record { i:int; s:file of string; }', got 'record { i:int; r:record { i:int; s:file of string; }; }'
error: Input stream optionalfiletable2: Table type does not match index type. Need type 'count':count, got 'string':string
error: Input stream optionalfiletable3: Stream event is a function, not an event
error: Input stream optionalfiletable3: Table event must take 4 arguments
error: Input stream optionalfiletable4: Table event's first attribute must be of type Input::TableDescription
error: Input stream optionalfiletable5: Table event's second attribute must be of type Input::Event
error: Input stream optionalfiletable6: Table event's index attributes do not match. Need 'record { c:count; }', got 'record { i:int; r:record { i:int; s:file of string; }; }'
error: Input stream optionalfiletable7: Table event's value attributes do not match. Need 'record { i:int; s:file of string; }', got 'record { i:int; r:record { i:int; s:file of string; }; }'
error: Input stream optionalfiletable8: Stream does not want a record (want_record=F), but has more then one value field.
error: Input stream optionalfiletable9: Table has less elements than index definition
error: Input stream optionalfiletable10: Table type has more indexes than index definition
error: Input stream optionalfiletable11: Table type does not match value type. Need type 'count', got 'int'
error: Input stream optionalfiletable12: Table type does not match value type. Need type 'count', got 'record { i:int; s:string; a:addr; }'
error: Input stream optionalfiletable14: Table type does not match value type. Need type 'int', got 'record { i:int; s:file of string; }'
error: Input stream optionalfiletable15: Table type does not match value type. Need type 'record { c:count; }', got 'record { i:int; s:string; a:addr; }'
error: Input stream event1: Stream event is a function, not an event
error: Input stream event2: Event does not take enough arguments
error: Input stream event3: Event's first attribute must be of type Input::EventDescription
error: Input stream event4: Event's second attribute must be of type Input::Event
error: Input stream event5: Incompatible type 'record':record { i:int; r:record { i:int; s:file of string; }; } for event, which needs type 'record':record { i:int; s:file of string; }
error: Input stream event6: Event has wrong number of arguments
error: Input stream event7: Incompatible type for event in field 3. Need type 'int':int, got 'record':record { i:int; r:record { i:int; s:file of string; }; }
error: Input stream event8: Incompatible type for event in field 5. Need type 'addr':addr, got 'string':string
error: Input stream event9: Event has wrong number of arguments
received termination signal

View file

@ -0,0 +1,2 @@
optionalfile
[i=-42, s=<uninitialized>]