From 80fb7166b4ba1464e6d902f1a543778841e2d441 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Tue, 3 Nov 2020 20:34:30 +0100 Subject: [PATCH] :art: Move tests --- Makefile | 2 +- tests/{import => driver}/Makefile | 0 .../driver.c => driver/simple_driver.c} | 16 +++---- tests/module/Makefile | 43 +++++++++++++++++++ tests/{import => module}/basic_module.c | 2 - tests/{import => module}/get_module.c | 9 ++-- tests/{import => module}/module.c | 2 - tests/plug/Makefile | 43 +++++++++++++++++++ tests/{import => plug}/array.c | 0 tests/{import => plug}/array_in_var_name.c | 0 .../{import => plug}/array_in_var_name_fail.c | 0 .../array_incoherent_in_var_name.c | 0 .../array_invalid_in_var_name.c | 0 tests/{import => plug}/callback.c | 0 tests/{import => plug}/callback.gwold | 0 tests/{import => plug}/callback2.gw | 0 tests/{import => plug}/class_template.c | 0 tests/{import => plug}/class_template.gw | 0 tests/{import => plug}/class_template_fail.c | 0 .../{import => plug}/class_template_invalid.c | 0 tests/{import => plug}/compile_file.c | 0 tests/{import => plug}/compile_string.c | 0 tests/{import => plug}/coverage.c | 0 tests/{import => plug}/coverage.gw | 0 tests/{import => plug}/empty_union.c | 0 tests/{import => plug}/end_class.c | 0 tests/{import => plug}/enum.c | 0 tests/{import => plug}/enum.gw | 0 tests/{import => plug}/enum_fail.c | 0 tests/{import => plug}/enum_fail2.c | 0 tests/{import => plug}/enum_fail3.c | 0 tests/{import => plug}/extend_array.c | 0 tests/{import => plug}/extend_array.gw | 0 tests/{import => plug}/fail_on_next_arg.c | 0 tests/{import => plug}/fail_on_next_arg2.c | 0 tests/{import => plug}/fptr.c | 0 tests/{import => plug}/fptr.gw | 0 tests/{import => plug}/fptr_tmpl.c | 0 tests/{import => plug}/fptr_tmpl_fail.c | 0 tests/{import => plug}/func_fail.c | 0 tests/{import => plug}/func_fail2.c | 0 tests/{import => plug}/func_fail3.c | 0 tests/{import => plug}/func_fail4.c | 0 .../func_subscript_not_empty.c | 0 tests/{import => plug}/func_tmpl.c | 0 tests/{import => plug}/func_tmpl.gw | 0 tests/{import => plug}/func_tmpl_fail.c | 0 tests/{import => plug}/func_too_many_arg.c | 0 tests/{import => plug}/global_func.c | 0 tests/{import => plug}/global_func.gw | 0 tests/{import => plug}/global_var.c | 0 tests/{import => plug}/global_var.gw | 0 tests/{import => plug}/invalid_arg.c | 0 tests/{import => plug}/invalid_array.c | 0 tests/{import => plug}/invalid_func.c | 0 tests/{import => plug}/invalid_names.c | 0 tests/{import => plug}/invalid_names0.c | 0 tests/{import => plug}/invalid_names1.c | 0 tests/{import => plug}/invalid_names2.c | 0 tests/{import => plug}/invalid_names3.c | 0 tests/{import => plug}/invalid_type1.c | 0 tests/{import => plug}/invalid_type2.c | 0 tests/{import => plug}/invalid_type3.c | 0 tests/{import => plug}/map2.gw | 0 tests/{import => plug}/mk_type_array.c | 0 tests/{import => plug}/no_import.c | 0 tests/{import => plug}/not_importing.c | 0 tests/{import => plug}/op_already_imported.c | 0 tests/{import => plug}/op_already_imported.gw | 1 + tests/{import => plug}/pass.c | 0 tests/{import => plug}/rm_me.gw | 0 tests/{import => plug}/specialid_emit.c | 0 tests/{import => plug}/specialid_emit.gw | 0 tests/{import => plug}/static_string.c | 0 tests/{import => plug}/static_string.gw | 0 tests/{import => plug}/str2decl.c | 0 tests/{import => plug}/str2list_fail.c | 0 tests/{import => plug}/template_arg.c | 0 tests/plug/test.log | 1 + tests/{import => plug}/trig.c | 0 tests/{import => plug}/trig.gw | 0 tests/{import => plug}/typedef.c | 0 tests/{import => plug}/typedef.gw | 0 tests/{import => plug}/typedef_fail.c | 0 tests/{import => plug}/typedef_tmpl.c | 0 tests/{import => plug}/ugen_connect.c | 0 tests/{import => plug}/union.c | 0 tests/{import => plug}/union.gw | 0 tests/{import => plug}/union_fail_exp.c | 0 tests/{import => plug}/union_member.c | 0 tests/{import => plug}/union_name.c | 0 tests/{import => plug}/union_name.gw | 0 tests/{import => plug}/union_tmpl.c | 0 tests/{import => plug}/union_tmpl.gw | 0 tests/{import => plug}/union_tmpl_fail.c | 0 tests/{import => plug}/union_tmpl_fail2.c | 0 tests/{import => plug}/union_tmpl_fail3.c | 0 tests/{import => plug}/variadic.c | 0 tests/{import => plug}/variadic.gw | 0 tests/{import => plug}/vm_remove.c | 0 tests/{import => plug}/vm_remove.gw | 0 tests/sh/import.sh | 33 ++++++++++---- 102 files changed, 124 insertions(+), 28 deletions(-) rename tests/{import => driver}/Makefile (100%) rename tests/{import/driver.c => driver/simple_driver.c} (53%) create mode 100644 tests/module/Makefile rename tests/{import => module}/basic_module.c (93%) rename tests/{import => module}/get_module.c (79%) rename tests/{import => module}/module.c (92%) create mode 100644 tests/plug/Makefile rename tests/{import => plug}/array.c (100%) rename tests/{import => plug}/array_in_var_name.c (100%) rename tests/{import => plug}/array_in_var_name_fail.c (100%) rename tests/{import => plug}/array_incoherent_in_var_name.c (100%) rename tests/{import => plug}/array_invalid_in_var_name.c (100%) rename tests/{import => plug}/callback.c (100%) rename tests/{import => plug}/callback.gwold (100%) rename tests/{import => plug}/callback2.gw (100%) rename tests/{import => plug}/class_template.c (100%) rename tests/{import => plug}/class_template.gw (100%) rename tests/{import => plug}/class_template_fail.c (100%) rename tests/{import => plug}/class_template_invalid.c (100%) rename tests/{import => plug}/compile_file.c (100%) rename tests/{import => plug}/compile_string.c (100%) rename tests/{import => plug}/coverage.c (100%) rename tests/{import => plug}/coverage.gw (100%) rename tests/{import => plug}/empty_union.c (100%) rename tests/{import => plug}/end_class.c (100%) rename tests/{import => plug}/enum.c (100%) rename tests/{import => plug}/enum.gw (100%) rename tests/{import => plug}/enum_fail.c (100%) rename tests/{import => plug}/enum_fail2.c (100%) rename tests/{import => plug}/enum_fail3.c (100%) rename tests/{import => plug}/extend_array.c (100%) rename tests/{import => plug}/extend_array.gw (100%) rename tests/{import => plug}/fail_on_next_arg.c (100%) rename tests/{import => plug}/fail_on_next_arg2.c (100%) rename tests/{import => plug}/fptr.c (100%) rename tests/{import => plug}/fptr.gw (100%) rename tests/{import => plug}/fptr_tmpl.c (100%) rename tests/{import => plug}/fptr_tmpl_fail.c (100%) rename tests/{import => plug}/func_fail.c (100%) rename tests/{import => plug}/func_fail2.c (100%) rename tests/{import => plug}/func_fail3.c (100%) rename tests/{import => plug}/func_fail4.c (100%) rename tests/{import => plug}/func_subscript_not_empty.c (100%) rename tests/{import => plug}/func_tmpl.c (100%) rename tests/{import => plug}/func_tmpl.gw (100%) rename tests/{import => plug}/func_tmpl_fail.c (100%) rename tests/{import => plug}/func_too_many_arg.c (100%) rename tests/{import => plug}/global_func.c (100%) rename tests/{import => plug}/global_func.gw (100%) rename tests/{import => plug}/global_var.c (100%) rename tests/{import => plug}/global_var.gw (100%) rename tests/{import => plug}/invalid_arg.c (100%) rename tests/{import => plug}/invalid_array.c (100%) rename tests/{import => plug}/invalid_func.c (100%) rename tests/{import => plug}/invalid_names.c (100%) rename tests/{import => plug}/invalid_names0.c (100%) rename tests/{import => plug}/invalid_names1.c (100%) rename tests/{import => plug}/invalid_names2.c (100%) rename tests/{import => plug}/invalid_names3.c (100%) rename tests/{import => plug}/invalid_type1.c (100%) rename tests/{import => plug}/invalid_type2.c (100%) rename tests/{import => plug}/invalid_type3.c (100%) rename tests/{import => plug}/map2.gw (100%) rename tests/{import => plug}/mk_type_array.c (100%) rename tests/{import => plug}/no_import.c (100%) rename tests/{import => plug}/not_importing.c (100%) rename tests/{import => plug}/op_already_imported.c (100%) rename tests/{import => plug}/op_already_imported.gw (59%) rename tests/{import => plug}/pass.c (100%) rename tests/{import => plug}/rm_me.gw (100%) rename tests/{import => plug}/specialid_emit.c (100%) rename tests/{import => plug}/specialid_emit.gw (100%) rename tests/{import => plug}/static_string.c (100%) rename tests/{import => plug}/static_string.gw (100%) rename tests/{import => plug}/str2decl.c (100%) rename tests/{import => plug}/str2list_fail.c (100%) rename tests/{import => plug}/template_arg.c (100%) create mode 100644 tests/plug/test.log rename tests/{import => plug}/trig.c (100%) rename tests/{import => plug}/trig.gw (100%) rename tests/{import => plug}/typedef.c (100%) rename tests/{import => plug}/typedef.gw (100%) rename tests/{import => plug}/typedef_fail.c (100%) rename tests/{import => plug}/typedef_tmpl.c (100%) rename tests/{import => plug}/ugen_connect.c (100%) rename tests/{import => plug}/union.c (100%) rename tests/{import => plug}/union.gw (100%) rename tests/{import => plug}/union_fail_exp.c (100%) rename tests/{import => plug}/union_member.c (100%) rename tests/{import => plug}/union_name.c (100%) rename tests/{import => plug}/union_name.gw (100%) rename tests/{import => plug}/union_tmpl.c (100%) rename tests/{import => plug}/union_tmpl.gw (100%) rename tests/{import => plug}/union_tmpl_fail.c (100%) rename tests/{import => plug}/union_tmpl_fail2.c (100%) rename tests/{import => plug}/union_tmpl_fail3.c (100%) rename tests/{import => plug}/variadic.c (100%) rename tests/{import => plug}/variadic.gw (100%) rename tests/{import => plug}/vm_remove.c (100%) rename tests/{import => plug}/vm_remove.gw (100%) diff --git a/Makefile b/Makefile index a5e21942..407d955f 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ src := $(wildcard src/*.c) src += $(wildcard src/*/*.c) test_dir_all := $(wildcard tests/*) -test_ignore = tests/import +test_ignore = tests/plug test/driver tests/module test_dir := $(filter-out $(test_ignore), $(test_dir_all)) test_dir += examples diff --git a/tests/import/Makefile b/tests/driver/Makefile similarity index 100% rename from tests/import/Makefile rename to tests/driver/Makefile diff --git a/tests/import/driver.c b/tests/driver/simple_driver.c similarity index 53% rename from tests/import/driver.c rename to tests/driver/simple_driver.c index 7f1628e5..22c2bccf 100644 --- a/tests/import/driver.c +++ b/tests/driver/simple_driver.c @@ -8,23 +8,21 @@ #include "gwion.h" #include "plug.h" -static DRVRUN(driver_test_run) { +static DRVRUN(simple_driver_run) { while(di->is_running) { di->run(vm); ++di->pos; } } -static DRVINI(driver_test_ini) { +static DRVINI(simple_driver_ini) { return GW_OK; } -static DRVDEL(driver_test_del) {} +static DRVDEL(simple_driver_del) {} -GWMODSTR(driver_test); - -GWDRIVER(driver_test) { - d->ini = driver_test_ini; - d->run = driver_test_run; - d->del = driver_test_del; +GWDRIVER(driver) { + d->ini = simple_driver_ini; + d->run = simple_driver_run; + d->del = simple_driver_del; } diff --git a/tests/module/Makefile b/tests/module/Makefile new file mode 100644 index 00000000..6327be10 --- /dev/null +++ b/tests/module/Makefile @@ -0,0 +1,43 @@ +INC = -I../../include -I../../util/include -I../../ast/include +CC ?= gcc + +NAME := ${NAME} +SRC = ${NAME}.c +OBJ = $(SRC:.c=.o) +CFLAGS += -std=c99 ${INC} -Wall -Wextra -g -Og + +# os specific +ifeq ($(shell uname), Darwin) +LDFLAGS += -bundle -undefined dynamic_lookup +else +ifeq ($(shell uname), Linux) +LDFLAGS += -shared +else +LDFLAGS += -shared -lpsapi -fPIC -Wl,--export-all -Wl,--enable-auto-import +LDFLAGS += -L../../ -lgwion +LDLAGS += ../../libgwion.dll.a +LDLAGS += ../../libgwion.a +endif +endif + +all: ${NAME}.so + + +${NAME}.so: ${OBJ} +ifeq (${USE_LD}, 1) + ${LD} $^ -o ${NAME}.so ${LDFLAGS} +else + ${CC} $^ -o ${NAME}.so ${LDFLAGS} +endif + +clean: + rm -f ${OBJ} ${NAME}.so + +.c.o: + ${CC} -fPIC ${CFLAGS} -c $< -o $(<:.c=.o) -g + +install: ${NAME}.so + install ${NAME}.so ${GWION_ADD_DIR} + +uninstall: + rm ${GWION_ADD_DIR}/${NAME}.so diff --git a/tests/import/basic_module.c b/tests/module/basic_module.c similarity index 93% rename from tests/import/basic_module.c rename to tests/module/basic_module.c index 11a37841..18d05fce 100644 --- a/tests/import/basic_module.c +++ b/tests/module/basic_module.c @@ -4,8 +4,6 @@ #include "vm.h" #include "gwion.h" -GWMODSTR(basic_module) - GWMODINI(basic_module) { puts("ini module"); if(args) { diff --git a/tests/import/get_module.c b/tests/module/get_module.c similarity index 79% rename from tests/import/get_module.c rename to tests/module/get_module.c index d4d11e62..6387d775 100644 --- a/tests/import/get_module.c +++ b/tests/module/get_module.c @@ -13,13 +13,12 @@ #include "gwi.h" #include "plug.h" -GWMODSTR(dummy_module); - -GWMODINI(dummy_module) { +GWMODINI(get_module) { puts(__func__); - return (void*)2; // we need to return something + return (void*)2; } -GWMODEND(dummy_module) { + +GWMODEND(get_module) { puts(__func__); } diff --git a/tests/import/module.c b/tests/module/module.c similarity index 92% rename from tests/import/module.c rename to tests/module/module.c index d65ee754..77ead7d7 100644 --- a/tests/import/module.c +++ b/tests/module/module.c @@ -8,8 +8,6 @@ #include "gwion.h" #include "plug.h" -GWMODSTR(dummy_module); - GWMODINI(dummy_module) { puts(__func__); return NULL; diff --git a/tests/plug/Makefile b/tests/plug/Makefile new file mode 100644 index 00000000..6327be10 --- /dev/null +++ b/tests/plug/Makefile @@ -0,0 +1,43 @@ +INC = -I../../include -I../../util/include -I../../ast/include +CC ?= gcc + +NAME := ${NAME} +SRC = ${NAME}.c +OBJ = $(SRC:.c=.o) +CFLAGS += -std=c99 ${INC} -Wall -Wextra -g -Og + +# os specific +ifeq ($(shell uname), Darwin) +LDFLAGS += -bundle -undefined dynamic_lookup +else +ifeq ($(shell uname), Linux) +LDFLAGS += -shared +else +LDFLAGS += -shared -lpsapi -fPIC -Wl,--export-all -Wl,--enable-auto-import +LDFLAGS += -L../../ -lgwion +LDLAGS += ../../libgwion.dll.a +LDLAGS += ../../libgwion.a +endif +endif + +all: ${NAME}.so + + +${NAME}.so: ${OBJ} +ifeq (${USE_LD}, 1) + ${LD} $^ -o ${NAME}.so ${LDFLAGS} +else + ${CC} $^ -o ${NAME}.so ${LDFLAGS} +endif + +clean: + rm -f ${OBJ} ${NAME}.so + +.c.o: + ${CC} -fPIC ${CFLAGS} -c $< -o $(<:.c=.o) -g + +install: ${NAME}.so + install ${NAME}.so ${GWION_ADD_DIR} + +uninstall: + rm ${GWION_ADD_DIR}/${NAME}.so diff --git a/tests/import/array.c b/tests/plug/array.c similarity index 100% rename from tests/import/array.c rename to tests/plug/array.c diff --git a/tests/import/array_in_var_name.c b/tests/plug/array_in_var_name.c similarity index 100% rename from tests/import/array_in_var_name.c rename to tests/plug/array_in_var_name.c diff --git a/tests/import/array_in_var_name_fail.c b/tests/plug/array_in_var_name_fail.c similarity index 100% rename from tests/import/array_in_var_name_fail.c rename to tests/plug/array_in_var_name_fail.c diff --git a/tests/import/array_incoherent_in_var_name.c b/tests/plug/array_incoherent_in_var_name.c similarity index 100% rename from tests/import/array_incoherent_in_var_name.c rename to tests/plug/array_incoherent_in_var_name.c diff --git a/tests/import/array_invalid_in_var_name.c b/tests/plug/array_invalid_in_var_name.c similarity index 100% rename from tests/import/array_invalid_in_var_name.c rename to tests/plug/array_invalid_in_var_name.c diff --git a/tests/import/callback.c b/tests/plug/callback.c similarity index 100% rename from tests/import/callback.c rename to tests/plug/callback.c diff --git a/tests/import/callback.gwold b/tests/plug/callback.gwold similarity index 100% rename from tests/import/callback.gwold rename to tests/plug/callback.gwold diff --git a/tests/import/callback2.gw b/tests/plug/callback2.gw similarity index 100% rename from tests/import/callback2.gw rename to tests/plug/callback2.gw diff --git a/tests/import/class_template.c b/tests/plug/class_template.c similarity index 100% rename from tests/import/class_template.c rename to tests/plug/class_template.c diff --git a/tests/import/class_template.gw b/tests/plug/class_template.gw similarity index 100% rename from tests/import/class_template.gw rename to tests/plug/class_template.gw diff --git a/tests/import/class_template_fail.c b/tests/plug/class_template_fail.c similarity index 100% rename from tests/import/class_template_fail.c rename to tests/plug/class_template_fail.c diff --git a/tests/import/class_template_invalid.c b/tests/plug/class_template_invalid.c similarity index 100% rename from tests/import/class_template_invalid.c rename to tests/plug/class_template_invalid.c diff --git a/tests/import/compile_file.c b/tests/plug/compile_file.c similarity index 100% rename from tests/import/compile_file.c rename to tests/plug/compile_file.c diff --git a/tests/import/compile_string.c b/tests/plug/compile_string.c similarity index 100% rename from tests/import/compile_string.c rename to tests/plug/compile_string.c diff --git a/tests/import/coverage.c b/tests/plug/coverage.c similarity index 100% rename from tests/import/coverage.c rename to tests/plug/coverage.c diff --git a/tests/import/coverage.gw b/tests/plug/coverage.gw similarity index 100% rename from tests/import/coverage.gw rename to tests/plug/coverage.gw diff --git a/tests/import/empty_union.c b/tests/plug/empty_union.c similarity index 100% rename from tests/import/empty_union.c rename to tests/plug/empty_union.c diff --git a/tests/import/end_class.c b/tests/plug/end_class.c similarity index 100% rename from tests/import/end_class.c rename to tests/plug/end_class.c diff --git a/tests/import/enum.c b/tests/plug/enum.c similarity index 100% rename from tests/import/enum.c rename to tests/plug/enum.c diff --git a/tests/import/enum.gw b/tests/plug/enum.gw similarity index 100% rename from tests/import/enum.gw rename to tests/plug/enum.gw diff --git a/tests/import/enum_fail.c b/tests/plug/enum_fail.c similarity index 100% rename from tests/import/enum_fail.c rename to tests/plug/enum_fail.c diff --git a/tests/import/enum_fail2.c b/tests/plug/enum_fail2.c similarity index 100% rename from tests/import/enum_fail2.c rename to tests/plug/enum_fail2.c diff --git a/tests/import/enum_fail3.c b/tests/plug/enum_fail3.c similarity index 100% rename from tests/import/enum_fail3.c rename to tests/plug/enum_fail3.c diff --git a/tests/import/extend_array.c b/tests/plug/extend_array.c similarity index 100% rename from tests/import/extend_array.c rename to tests/plug/extend_array.c diff --git a/tests/import/extend_array.gw b/tests/plug/extend_array.gw similarity index 100% rename from tests/import/extend_array.gw rename to tests/plug/extend_array.gw diff --git a/tests/import/fail_on_next_arg.c b/tests/plug/fail_on_next_arg.c similarity index 100% rename from tests/import/fail_on_next_arg.c rename to tests/plug/fail_on_next_arg.c diff --git a/tests/import/fail_on_next_arg2.c b/tests/plug/fail_on_next_arg2.c similarity index 100% rename from tests/import/fail_on_next_arg2.c rename to tests/plug/fail_on_next_arg2.c diff --git a/tests/import/fptr.c b/tests/plug/fptr.c similarity index 100% rename from tests/import/fptr.c rename to tests/plug/fptr.c diff --git a/tests/import/fptr.gw b/tests/plug/fptr.gw similarity index 100% rename from tests/import/fptr.gw rename to tests/plug/fptr.gw diff --git a/tests/import/fptr_tmpl.c b/tests/plug/fptr_tmpl.c similarity index 100% rename from tests/import/fptr_tmpl.c rename to tests/plug/fptr_tmpl.c diff --git a/tests/import/fptr_tmpl_fail.c b/tests/plug/fptr_tmpl_fail.c similarity index 100% rename from tests/import/fptr_tmpl_fail.c rename to tests/plug/fptr_tmpl_fail.c diff --git a/tests/import/func_fail.c b/tests/plug/func_fail.c similarity index 100% rename from tests/import/func_fail.c rename to tests/plug/func_fail.c diff --git a/tests/import/func_fail2.c b/tests/plug/func_fail2.c similarity index 100% rename from tests/import/func_fail2.c rename to tests/plug/func_fail2.c diff --git a/tests/import/func_fail3.c b/tests/plug/func_fail3.c similarity index 100% rename from tests/import/func_fail3.c rename to tests/plug/func_fail3.c diff --git a/tests/import/func_fail4.c b/tests/plug/func_fail4.c similarity index 100% rename from tests/import/func_fail4.c rename to tests/plug/func_fail4.c diff --git a/tests/import/func_subscript_not_empty.c b/tests/plug/func_subscript_not_empty.c similarity index 100% rename from tests/import/func_subscript_not_empty.c rename to tests/plug/func_subscript_not_empty.c diff --git a/tests/import/func_tmpl.c b/tests/plug/func_tmpl.c similarity index 100% rename from tests/import/func_tmpl.c rename to tests/plug/func_tmpl.c diff --git a/tests/import/func_tmpl.gw b/tests/plug/func_tmpl.gw similarity index 100% rename from tests/import/func_tmpl.gw rename to tests/plug/func_tmpl.gw diff --git a/tests/import/func_tmpl_fail.c b/tests/plug/func_tmpl_fail.c similarity index 100% rename from tests/import/func_tmpl_fail.c rename to tests/plug/func_tmpl_fail.c diff --git a/tests/import/func_too_many_arg.c b/tests/plug/func_too_many_arg.c similarity index 100% rename from tests/import/func_too_many_arg.c rename to tests/plug/func_too_many_arg.c diff --git a/tests/import/global_func.c b/tests/plug/global_func.c similarity index 100% rename from tests/import/global_func.c rename to tests/plug/global_func.c diff --git a/tests/import/global_func.gw b/tests/plug/global_func.gw similarity index 100% rename from tests/import/global_func.gw rename to tests/plug/global_func.gw diff --git a/tests/import/global_var.c b/tests/plug/global_var.c similarity index 100% rename from tests/import/global_var.c rename to tests/plug/global_var.c diff --git a/tests/import/global_var.gw b/tests/plug/global_var.gw similarity index 100% rename from tests/import/global_var.gw rename to tests/plug/global_var.gw diff --git a/tests/import/invalid_arg.c b/tests/plug/invalid_arg.c similarity index 100% rename from tests/import/invalid_arg.c rename to tests/plug/invalid_arg.c diff --git a/tests/import/invalid_array.c b/tests/plug/invalid_array.c similarity index 100% rename from tests/import/invalid_array.c rename to tests/plug/invalid_array.c diff --git a/tests/import/invalid_func.c b/tests/plug/invalid_func.c similarity index 100% rename from tests/import/invalid_func.c rename to tests/plug/invalid_func.c diff --git a/tests/import/invalid_names.c b/tests/plug/invalid_names.c similarity index 100% rename from tests/import/invalid_names.c rename to tests/plug/invalid_names.c diff --git a/tests/import/invalid_names0.c b/tests/plug/invalid_names0.c similarity index 100% rename from tests/import/invalid_names0.c rename to tests/plug/invalid_names0.c diff --git a/tests/import/invalid_names1.c b/tests/plug/invalid_names1.c similarity index 100% rename from tests/import/invalid_names1.c rename to tests/plug/invalid_names1.c diff --git a/tests/import/invalid_names2.c b/tests/plug/invalid_names2.c similarity index 100% rename from tests/import/invalid_names2.c rename to tests/plug/invalid_names2.c diff --git a/tests/import/invalid_names3.c b/tests/plug/invalid_names3.c similarity index 100% rename from tests/import/invalid_names3.c rename to tests/plug/invalid_names3.c diff --git a/tests/import/invalid_type1.c b/tests/plug/invalid_type1.c similarity index 100% rename from tests/import/invalid_type1.c rename to tests/plug/invalid_type1.c diff --git a/tests/import/invalid_type2.c b/tests/plug/invalid_type2.c similarity index 100% rename from tests/import/invalid_type2.c rename to tests/plug/invalid_type2.c diff --git a/tests/import/invalid_type3.c b/tests/plug/invalid_type3.c similarity index 100% rename from tests/import/invalid_type3.c rename to tests/plug/invalid_type3.c diff --git a/tests/import/map2.gw b/tests/plug/map2.gw similarity index 100% rename from tests/import/map2.gw rename to tests/plug/map2.gw diff --git a/tests/import/mk_type_array.c b/tests/plug/mk_type_array.c similarity index 100% rename from tests/import/mk_type_array.c rename to tests/plug/mk_type_array.c diff --git a/tests/import/no_import.c b/tests/plug/no_import.c similarity index 100% rename from tests/import/no_import.c rename to tests/plug/no_import.c diff --git a/tests/import/not_importing.c b/tests/plug/not_importing.c similarity index 100% rename from tests/import/not_importing.c rename to tests/plug/not_importing.c diff --git a/tests/import/op_already_imported.c b/tests/plug/op_already_imported.c similarity index 100% rename from tests/import/op_already_imported.c rename to tests/plug/op_already_imported.c diff --git a/tests/import/op_already_imported.gw b/tests/plug/op_already_imported.gw similarity index 59% rename from tests/import/op_already_imported.gw rename to tests/plug/op_already_imported.gw index 2bfc227d..ddbb3b6a 100644 --- a/tests/import/op_already_imported.gw +++ b/tests/plug/op_already_imported.gw @@ -1,2 +1,3 @@ #! [contains] already imported +#require op_already_imported <<< 1 >>>; diff --git a/tests/import/pass.c b/tests/plug/pass.c similarity index 100% rename from tests/import/pass.c rename to tests/plug/pass.c diff --git a/tests/import/rm_me.gw b/tests/plug/rm_me.gw similarity index 100% rename from tests/import/rm_me.gw rename to tests/plug/rm_me.gw diff --git a/tests/import/specialid_emit.c b/tests/plug/specialid_emit.c similarity index 100% rename from tests/import/specialid_emit.c rename to tests/plug/specialid_emit.c diff --git a/tests/import/specialid_emit.gw b/tests/plug/specialid_emit.gw similarity index 100% rename from tests/import/specialid_emit.gw rename to tests/plug/specialid_emit.gw diff --git a/tests/import/static_string.c b/tests/plug/static_string.c similarity index 100% rename from tests/import/static_string.c rename to tests/plug/static_string.c diff --git a/tests/import/static_string.gw b/tests/plug/static_string.gw similarity index 100% rename from tests/import/static_string.gw rename to tests/plug/static_string.gw diff --git a/tests/import/str2decl.c b/tests/plug/str2decl.c similarity index 100% rename from tests/import/str2decl.c rename to tests/plug/str2decl.c diff --git a/tests/import/str2list_fail.c b/tests/plug/str2list_fail.c similarity index 100% rename from tests/import/str2list_fail.c rename to tests/plug/str2list_fail.c diff --git a/tests/import/template_arg.c b/tests/plug/template_arg.c similarity index 100% rename from tests/import/template_arg.c rename to tests/plug/template_arg.c diff --git a/tests/plug/test.log b/tests/plug/test.log new file mode 100644 index 00000000..87ce6cd6 --- /dev/null +++ b/tests/plug/test.log @@ -0,0 +1 @@ +op_already_imported.gw diff --git a/tests/import/trig.c b/tests/plug/trig.c similarity index 100% rename from tests/import/trig.c rename to tests/plug/trig.c diff --git a/tests/import/trig.gw b/tests/plug/trig.gw similarity index 100% rename from tests/import/trig.gw rename to tests/plug/trig.gw diff --git a/tests/import/typedef.c b/tests/plug/typedef.c similarity index 100% rename from tests/import/typedef.c rename to tests/plug/typedef.c diff --git a/tests/import/typedef.gw b/tests/plug/typedef.gw similarity index 100% rename from tests/import/typedef.gw rename to tests/plug/typedef.gw diff --git a/tests/import/typedef_fail.c b/tests/plug/typedef_fail.c similarity index 100% rename from tests/import/typedef_fail.c rename to tests/plug/typedef_fail.c diff --git a/tests/import/typedef_tmpl.c b/tests/plug/typedef_tmpl.c similarity index 100% rename from tests/import/typedef_tmpl.c rename to tests/plug/typedef_tmpl.c diff --git a/tests/import/ugen_connect.c b/tests/plug/ugen_connect.c similarity index 100% rename from tests/import/ugen_connect.c rename to tests/plug/ugen_connect.c diff --git a/tests/import/union.c b/tests/plug/union.c similarity index 100% rename from tests/import/union.c rename to tests/plug/union.c diff --git a/tests/import/union.gw b/tests/plug/union.gw similarity index 100% rename from tests/import/union.gw rename to tests/plug/union.gw diff --git a/tests/import/union_fail_exp.c b/tests/plug/union_fail_exp.c similarity index 100% rename from tests/import/union_fail_exp.c rename to tests/plug/union_fail_exp.c diff --git a/tests/import/union_member.c b/tests/plug/union_member.c similarity index 100% rename from tests/import/union_member.c rename to tests/plug/union_member.c diff --git a/tests/import/union_name.c b/tests/plug/union_name.c similarity index 100% rename from tests/import/union_name.c rename to tests/plug/union_name.c diff --git a/tests/import/union_name.gw b/tests/plug/union_name.gw similarity index 100% rename from tests/import/union_name.gw rename to tests/plug/union_name.gw diff --git a/tests/import/union_tmpl.c b/tests/plug/union_tmpl.c similarity index 100% rename from tests/import/union_tmpl.c rename to tests/plug/union_tmpl.c diff --git a/tests/import/union_tmpl.gw b/tests/plug/union_tmpl.gw similarity index 100% rename from tests/import/union_tmpl.gw rename to tests/plug/union_tmpl.gw diff --git a/tests/import/union_tmpl_fail.c b/tests/plug/union_tmpl_fail.c similarity index 100% rename from tests/import/union_tmpl_fail.c rename to tests/plug/union_tmpl_fail.c diff --git a/tests/import/union_tmpl_fail2.c b/tests/plug/union_tmpl_fail2.c similarity index 100% rename from tests/import/union_tmpl_fail2.c rename to tests/plug/union_tmpl_fail2.c diff --git a/tests/import/union_tmpl_fail3.c b/tests/plug/union_tmpl_fail3.c similarity index 100% rename from tests/import/union_tmpl_fail3.c rename to tests/plug/union_tmpl_fail3.c diff --git a/tests/import/variadic.c b/tests/plug/variadic.c similarity index 100% rename from tests/import/variadic.c rename to tests/plug/variadic.c diff --git a/tests/import/variadic.gw b/tests/plug/variadic.gw similarity index 100% rename from tests/import/variadic.gw rename to tests/plug/variadic.gw diff --git a/tests/import/vm_remove.c b/tests/plug/vm_remove.c similarity index 100% rename from tests/import/vm_remove.c rename to tests/plug/vm_remove.c diff --git a/tests/import/vm_remove.gw b/tests/plug/vm_remove.gw similarity index 100% rename from tests/import/vm_remove.gw rename to tests/plug/vm_remove.gw diff --git a/tests/sh/import.sh b/tests/sh/import.sh index 3687b21c..b102ec59 100644 --- a/tests/sh/import.sh +++ b/tests/sh/import.sh @@ -1,5 +1,5 @@ #!/bin/bash -# [test] #77 +# [test] #75 n=0 [ "$1" ] && n="$1" @@ -12,13 +12,14 @@ source tests/sh/test.sh export GWION_ADD_DIR test_plugin() { - export NAME=$"$1" - export PRG=$"../../gwion" - export SUPP=$"../../scripts/supp" + export NAME="$1" + export PRG="../../gwion" + export SUPP="../../scripts/supp" make +# we might have a test file for all now if [ -f "$NAME.gw" ] - then GWOPT+=-p. test_gw "$NAME.gw" "$n" - else GWOPT+=-p. test_gw "no_file" "$n" + then GWOPT+="-p." test_gw "$NAME.gw" "$n" + else GWOPT+="-p." test_gw "no_file" "$n" fi make clean N=$(printf "% 4i" "$n") @@ -36,13 +37,27 @@ rm "empty.so" BASE_DIR="$PWD" -cd tests/import || exit +pushd tests/plug || exit for test_file in *.c do test_plugin "$(basename "$test_file" .c)" done +popd -DRIVER="driver_test:arg" test_plugin driver -MODULE="dummy_module=with,some,argument" test_plugin module +pushd tests/driver || exit +for test_file in *.c +do + NAME="$(basename "$test_file" .c)" + GWOPT+="-d $NAME" test_plugin "$(basename "$test_file" .c)" +done +popd || exit + +pushd tests/module || exit +for test_file in *.c +do + NAME="$(basename "$test_file" .c)" + GWOPT+="-m $NAME" test_plugin "$NAME" +done +popd || exit # clean rm -f ./*.gcda ./*.gcno vgcore.* ./*.o ./*.so -- 2.43.0