All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit c103639d authored by Sarah Spall's avatar Sarah Spall Committed by Vikram Narayanan

moving to a python test harness, to make adding new tests easier, and add make test

parent 26e25b34
......@@ -2,18 +2,21 @@
lcd_compiler: lcd_ast.o lcd_compiler.o lcd_idl.o
g++ lcd_idl.o lcd_ast.o lcd_compiler.o -o compiler
lcd_compiler.o: lcd_compiler.cpp lcd_ast.h lcd_idl.h
lcd_compiler.o: lcd_compiler.cpp include/lcd_ast.h lcd_idl.h
g++ -c -g lcd_compiler.cpp
lcd_idl.o: lcd_idl.h lcd_ast.h
lcd_idl.o: parser/lcd_idl.h include/lcd_ast.h
lcd_ast.o: lcd_ast.h
lcd_ast.o: include/lcd_ast.h
lcd_idl.h:
vembyr-1.1/peg.py --h lcd_idl.peg > lcd_idl.h
parser/vembyr-1.1/peg.py --h parser/lcd_idl.peg > parser/lcd_idl.h
lcd_idl.cpp:
vembyr-1.1/peg.py --cpp lcd_idl.peg > lcd_idl.cpp
parser/vembyr-1.1/peg.py --cpp parser/lcd_idl.peg > parser/lcd_idl.cpp
clean:
rm lcd_idl.cpp lcd_idl.h lcd_ast.h.gch compiler *.o
\ No newline at end of file
rm lcd_idl.cpp lcd_idl.h lcd_ast.h.gch compiler *.o
test: lcd_compiler
./test/test.py
......@@ -305,7 +305,7 @@ Line_comment = Line_comm_start Line_comm_rest
Line_comm_end = "\n"
git stsigned_type = "int" {{ value = getType("int");}}
signed_type = "int" {{ value = getType("int");}}
| "char" {{ value = getType("char"); }}
| "capability" {{ value = getType("capability"); }}
| "short" {{ value = getType("short");}}
......
#include "test.h"
int main(int argc, char ** argv)
{
if(argc != 2)
{
exit(0);
}
try
{
char * file = argv[1];
Parser::parse(std::string(file));
printf("completed call to parse\n");
}
catch (const Parser::ParseException e)
{
exit(0);
}
}
#!/usr/bin/env python3
from os import getcwd, listdir
from os.path import join
from subprocess import call, check_output
def main():
print("in main")
test_dir = getcwd()
comp_dir = "../compiler"
out_dir = join(test_dir, "out")
for file in listdir(test_dir):
print("in loop: " + file)
if file.endswith(".idl"):
try:
result = check_output([comp_dir, '-header', file], timeout=2)
print("in try")
except:
print("in except")
pass
if __name__ == '__main__':
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment