nail icon indicating copy to clipboard operation
nail copied to clipboard

The supplied tests do not compile

Open aldanor opened this issue 9 years ago • 0 comments

When trying to run tests via generator/run-tests.sh (is it outdated?):

$ ./run-tests.sh 
make: Nothing to be done for `all'.
sh: test.nail: No such file or directory
Syntax error in grammar

When trying to run tests via tests/run-tests.sh, there's a multitude of errors:

$ ./run-tests.sh 
~/dev/pcap/foo/nail/generator ~/dev/pcap/foo/nail/tests
make: Nothing to be done for `all'.
~/dev/pcap/foo/nail/tests
Running fixedarray.nail
./harness.sh: line 13: astyle: command not found
rm: fixedarray.nail.c.orig: No such file or directory
Failed compiling  
 test_harness.c:12:5: error: use of undeclared identifier 'NailArena'
    NailArena arena;
    ^
test_harness.c:13:5: error: use of undeclared identifier 'pos'
    pos p;
    ^
test_harness.c:19:5: warning: implicit declaration of function 'NailArena_init' is invalid in C99 [-Wimplicit-function-declaration]
    NailArena_init(&arena,4096);
    ^
test_harness.c:19:21: error: use of undeclared identifier 'arena'
    NailArena_init(&arena,4096);
                    ^
test_harness.c:21:5: error: use of undeclared identifier 'foo'
    XYZZY *object; 
    ^
test_harness.c:5:15: note: expanded from macro 'XYZZY'
#define XYZZY foo
              ^
test_harness.c:21:12: error: use of undeclared identifier 'object'
    XYZZY *object; 
           ^
test_harness.c:22:5: error: use of undeclared identifier 'object'
    object = CAT(parse_,XYZZY)(&arena,input,inputsize);
    ^
test_harness.c:22:14: warning: implicit declaration of function 'parse_foo' is invalid in C99 [-Wimplicit-function-declaration]
    object = CAT(parse_,XYZZY)(&arena,input,inputsize);
             ^
test_harness.c:4:18: note: expanded from macro 'CAT'
#define CAT(x,y) TOKENPASTE(x,y)
                 ^
test_harness.c:3:25: note: expanded from macro 'TOKENPASTE'
#define TOKENPASTE(x,y) x ## y
                        ^
<scratch space>:153:1: note: expanded from here
parse_foo
^
test_harness.c:22:33: error: use of undeclared identifier 'arena'
    object = CAT(parse_,XYZZY)(&arena,input,inputsize);
                                ^
test_harness.c:23:8: error: use of undeclared identifier 'object'
    if(object){
       ^
test_harness.c:27:13: error: use of undeclared identifier 'NailStream'
            NailStream stream;
            ^
test_harness.c:28:13: warning: implicit declaration of function 'NailOutStream_init' is invalid in C99 [-Wimplicit-function-declaration]
            NailOutStream_init(&stream,4096);
            ^
test_harness.c:28:33: error: use of undeclared identifier 'stream'
            NailOutStream_init(&stream,4096);
                                ^
test_harness.c:29:15: warning: implicit declaration of function 'gen_foo' is invalid in C99 [-Wimplicit-function-declaration]
           if(CAT(gen_,XYZZY)(&arena,&stream,object)<0)
              ^
test_harness.c:4:18: note: expanded from macro 'CAT'
#define CAT(x,y) TOKENPASTE(x,y)
                 ^
test_harness.c:3:25: note: expanded from macro 'TOKENPASTE'
#define TOKENPASTE(x,y) x ## y
                        ^
<scratch space>:153:1: note: expanded from here
gen_foo
^
test_harness.c:29:32: error: use of undeclared identifier 'arena'
           if(CAT(gen_,XYZZY)(&arena,&stream,object)<0)
                               ^
test_harness.c:29:39: error: use of undeclared identifier 'stream'
           if(CAT(gen_,XYZZY)(&arena,&stream,object)<0)
                                      ^
test_harness.c:29:46: error: use of undeclared identifier 'object'
           if(CAT(gen_,XYZZY)(&arena,&stream,object)<0)
                                             ^
test_harness.c:32:31: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
                              exit(-1);
                              ^
test_harness.c:32:31: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
test_harness.c:34:19: warning: implicit declaration of function 'NailOutStream_buffer' is invalid in C99 [-Wimplicit-function-declaration]
            buf = NailOutStream_buffer(&stream,&siz);
                  ^
test_harness.c:34:41: error: use of undeclared identifier 'stream'
            buf = NailOutStream_buffer(&stream,&siz);
                                        ^
test_harness.c:7:5: error: redefinition of 'main'
int main(){
    ^
test_harness.c:7:5: note: previous definition is here
int main(){
    ^
test_harness.c:12:5: error: use of undeclared identifier 'NailArena'
    NailArena arena;
    ^
test_harness.c:13:5: error: use of undeclared identifier 'pos'
    pos p;
    ^
test_harness.c:19:21: error: use of undeclared identifier 'arena'
    NailArena_init(&arena,4096);
                    ^
test_harness.c:21:5: error: use of undeclared identifier 'foo'
    XYZZY *object; 
    ^
test_harness.c:5:15: note: expanded from macro 'XYZZY'
#define XYZZY foo
              ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
6 warnings and 20 errors generated.

aldanor avatar Dec 13 '15 22:12 aldanor