Igalia / snabb

Snabb Switch: Fast open source packet processing
Apache License 2.0
47 stars 5 forks source link

Improve error messages for invalid config files #1159

Closed dpino closed 5 years ago

dpino commented 6 years ago

Fixes #1020

dpino commented 6 years ago

Example:

$ sudo ./snabb lwaftr run --name lwaftr --cpu 10 --conf lwaftr-64k.conf --on-a-stick 82:00.0
lwaftr-64k.conf: loading compiled configuration from lwaftr-64k.o
lwaftr-64k.conf: compiled configuration is out of date; recompiling.
lwaftr-64k.conf: loading source configuration
      queue1 {
            ^
lwaftr-64k.conf:64049:12: error: unrecognized parameter: queue1
wingo commented 5 years ago

The file name is available as stream.io.filename, so no need to plumb around. Probably we should add a method on stream to return it. WDYT?

dpino commented 5 years ago

OK, I amended the patches to add a stream:filename()' method and use it from Parser, instead of passingfilename` around.