mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-03-23 03:01:30 +00:00
Invoke tests
This commit is contained in:
parent
453ca45176
commit
8156374a71
5 changed files with 19 additions and 17 deletions
15
Makefile
15
Makefile
|
@ -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
7
main.c
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
8
util.c
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue