aboutsummaryrefslogtreecommitdiff
path: root/tests/binpack.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-10-13 13:39:50 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2013-10-13 13:56:37 +0300
commit58f7dbc0658b3d73816a1bc91b75c2bdac733510 (patch)
tree3d971a9b1a3fd25ca46588112c3a314f971d584f /tests/binpack.c
parent23f262e8c6181465347c3bb47644f9d86fcb7432 (diff)
downloadvmod-binlog-58f7dbc0658b3d73816a1bc91b75c2bdac733510.tar.gz
vmod-binlog-58f7dbc0658b3d73816a1bc91b75c2bdac733510.tar.bz2
Fix error checking, add pack tests.
* src/binlog.c (vmod_init): Fix error checking after packcomp. * src/binlogcat.c (catlog): Likewise. * tests/binpack.c (main): Likewise. * src/pack.c (Z_unpacker): Fix output format. (packcomp): allow for whitespace between specifiers. On error set errno and return NULL. * tests/Makefile.am: Add pack.at * tests/testsuite.at: Likewise. * tests/pack.at: New file. * tests/test02.at: Fix name pattern.
Diffstat (limited to 'tests/binpack.c')
-rw-r--r--tests/binpack.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/binpack.c b/tests/binpack.c
index b54ed80..482e658 100644
--- a/tests/binpack.c
+++ b/tests/binpack.c
@@ -18,6 +18,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
#include "pack.h"
#include "err.h"
@@ -52,11 +54,12 @@ main(int argc, char **argv)
pi = packcomp(argv[0], &end);
if (!pi) {
- error("out of memory");
- abort();
- }
- if (*end) {
- error("compile error near %s", end);
+ if (errno == EINVAL) {
+ error("%s: bad dataspec near %s", argv[0], end);
+ exit(1);
+ }
+
+ error("%s", strerror(errno));
exit(1);
}
env = packenv_create(packsize(pi));

Return to:

Send suggestions and report system problems to the System administrator.