Tested the engine on linux

This commit is contained in:
2022-10-02 16:18:13 +11:00
parent cf76513c8a
commit b59696bebc
5 changed files with 22 additions and 5 deletions

View File

@@ -14,11 +14,13 @@ OBJ = $(addprefix $(ODIR)/,$(TARGETS:../core/%.c=%.o)) $(addprefix $(ODIR)/,$(TE
all: $(OBJ) $(TESTS:%.c=../$(OUTDIR)/%.exe)
../$(OUTDIR)/%.exe: $(ODIR)/%.o
@$(CC) -o $@ $< $(TARGETS:../core/%.c=$(ODIR)/%.o) $(CFLAGS) -L../$(LIBDIR) $(LIBS)
cp ../$(LIBDIR)/*.dll ../$(OUTDIR)
ifeq ($(shell uname),Linux)
@$(CC) -o $@ $< $(TARGETS:../core/%.c=$(ODIR)/%.o) $(CFLAGS) -Wl,-rpath,../out -L../$(LIBDIR) $(LIBS)
cp ../$(LIBDIR)/*.so ../$(OUTDIR)
valgrind --leak-check=full --track-origins=yes $@
else
@$(CC) -o $@ $< $(TARGETS:../core/%.c=$(ODIR)/%.o) $(CFLAGS) -L../$(LIBDIR) $(LIBS)
cp ../$(LIBDIR)/*.dll ../$(OUTDIR)
$@
endif

View File

@@ -10,6 +10,11 @@
#include <stdlib.h>
#include <string.h>
//suppress the print keyword
static void noPrintFn(const char* output) {
//NO OP
}
//compilation functions
char* readFile(char* path, size_t* fileSize) {
FILE* file = fopen(path, "rb");
@@ -87,6 +92,7 @@ int main() {
//setup interpreter
Interpreter interpreter;
initInterpreter(&interpreter);
setInterpreterPrint(&interpreter, noPrintFn);
size_t size = 0;
@@ -113,6 +119,7 @@ int main() {
//setup interpreter
Interpreter interpreter;
initInterpreter(&interpreter);
setInterpreterPrint(&interpreter, noPrintFn);
size_t size = 0;
@@ -134,6 +141,8 @@ int main() {
resetInterpreter(&interpreter);
pushEngineNode(&node, &child);
free((void*)source);
}
//test the calls