added build project test and fixed segfault
This commit is contained in:
parent
4703486daf
commit
3c5b9b7fe3
|
@ -258,6 +258,10 @@ static int parse_project_table(ProjectConfig *config, const toml_table_t *projec
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_mode_from_str(TargetCompilationMode* mode, const char* name) {
|
static int get_mode_from_str(TargetCompilationMode* mode, const char* name) {
|
||||||
|
if (mode == NULL) {
|
||||||
|
return PROJECT_SEMANTIC_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(name, "application") == 0) {
|
if (strcmp(name, "application") == 0) {
|
||||||
*mode = Application;
|
*mode = Application;
|
||||||
return PROJECT_OK;
|
return PROJECT_OK;
|
||||||
|
|
|
@ -10,3 +10,4 @@ add_subdirectory(logging)
|
||||||
add_subdirectory(input_file)
|
add_subdirectory(input_file)
|
||||||
add_subdirectory(ast)
|
add_subdirectory(ast)
|
||||||
add_subdirectory(glib)
|
add_subdirectory(glib)
|
||||||
|
add_subdirectory(project)
|
|
@ -0,0 +1,9 @@
|
||||||
|
include(CTest)
|
||||||
|
|
||||||
|
# ------------------------------------------------------- #
|
||||||
|
# CTEST 1
|
||||||
|
# test if the program successfully reads the project config
|
||||||
|
|
||||||
|
add_test(NAME project_build
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests/project
|
||||||
|
COMMAND python ${GEMSTONE_TEST_DIR}/project/test_project.py)
|
|
@ -0,0 +1,15 @@
|
||||||
|
[project]
|
||||||
|
authors = [ "Sven Vogel" ]
|
||||||
|
license = "GPL-2.0"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "This is a test project"
|
||||||
|
|
||||||
|
[target.debug]
|
||||||
|
root = "src/main.txt"
|
||||||
|
output = "bin"
|
||||||
|
archive = "archive"
|
||||||
|
opt = 1
|
||||||
|
print_ast = true
|
||||||
|
print_asm = true
|
||||||
|
print_ir = true
|
||||||
|
mode = "application"
|
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
fun main(out int: e) {
|
||||||
|
e = 0
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
import subprocess
|
||||||
|
import logging
|
||||||
|
from logging import info, error
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
info("started check output...")
|
||||||
|
|
||||||
|
p = subprocess.run([ "../../bin/debug/gsc", "build", "all" ], capture_output=True, text=True)
|
||||||
|
|
||||||
|
info("checking exit code...")
|
||||||
|
|
||||||
|
print(p.stdout)
|
||||||
|
|
||||||
|
# check exit code
|
||||||
|
assert p.returncode == 0
|
Loading…
Reference in New Issue