Invoke tests

This commit is contained in:
Dale Weiler 2012-04-29 17:28:01 -04:00
parent 453ca45176
commit 8156374a71
5 changed files with 19 additions and 17 deletions

View file

@ -1,7 +1,6 @@
CC ?= clang
CFLAGS += -Wall -I. -pedantic-errors -std=c90
OBJ = main.o \
lex.o \
OBJ = lex.o \
error.o \
parse.o \
typedef.o \
@ -10,9 +9,9 @@ OBJ = main.o \
asm.o \
ast.o \
ir.o
# ast and ir test
TEST_AST = test/ast-test.o
TEST_IR = test/ir-test.o
OBJ_A = test/ast-test.o
OBJ_I = test/ir-test.o
OBJ_C = main.o
#default is compiler only
default: gmqcc
@ -20,14 +19,14 @@ default: gmqcc
$(CC) -c $< -o $@ $(CFLAGS)
# test targets
test_ast: $(TEST_AST) $(OBJ)
test_ast: $(OBJ_A) $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
test_ir: $(TEST_IR) $(OBJ)
test_ir: $(OBJ_I) $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
test: test_ast test_ir
# compiler target
gmqcc: $(OBJ)
gmqcc: $(OBJ_C) $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
#all target is test and all

7
main.c
View file

@ -24,13 +24,6 @@
typedef struct { char *name, type; } argitem;
VECTOR_MAKE(argitem, items);
/* global options */
bool opts_debug = false;
bool opts_memchk = false;
bool opts_darkplaces_stringtablebug = false;
bool opts_omit_nullcode = false;
int opts_compiler = COMPILER_GMQCC;
static const int usage(const char *const app) {
printf("usage:\n"
" %s -c<file> -oprog.dat -- compile file\n"

View file

@ -12,7 +12,7 @@
VECTOR_MAKE(ast_value*, globals);
VECTOR_MAKE(ast_function*, functions);
void testast()
int main()
{
ast_expression *exp;
ast_value *gfoo = NULL;
@ -117,4 +117,5 @@ void testast()
}
if (globals_data)
mem_d(globals_data);
return 0;
}

View file

@ -1,6 +1,6 @@
#include "gmqcc.h"
#include "ir.h"
void builder1()
int main()
{
ir_builder *b = ir_builder_new("test");
ir_value *va = ir_builder_create_global(b, "a", TYPE_FLOAT);
@ -101,4 +101,5 @@ void builder1()
ir_value_dump_life(la, printf);
ir_builder_delete(b);
return 0;
}

8
util.c
View file

@ -399,3 +399,11 @@ int util_getline(char **lineptr, size_t *n, FILE *stream) {
*pos = '\0';
return (ret = pos - *lineptr);
}
/* TODO: opts.c? when it gets large enugh */
/* global options */
bool opts_debug = false;
bool opts_memchk = false;
bool opts_darkplaces_stringtablebug = false;
bool opts_omit_nullcode = false;
int opts_compiler = COMPILER_GMQCC;