]> Nishi Git Mirror - gwion.git/commitdiff
:art: Move tests
authorfennecdjay <fennecdjay@gwion.tk>
Tue, 3 Nov 2020 19:34:30 +0000 (20:34 +0100)
committerfennecdjay <fennecdjay@gwion.tk>
Tue, 3 Nov 2020 19:34:30 +0000 (20:34 +0100)
102 files changed:
Makefile
tests/driver/Makefile [moved from tests/import/Makefile with 100% similarity]
tests/driver/simple_driver.c [moved from tests/import/driver.c with 53% similarity]
tests/module/Makefile [new file with mode: 0644]
tests/module/basic_module.c [moved from tests/import/basic_module.c with 93% similarity]
tests/module/get_module.c [moved from tests/import/get_module.c with 79% similarity]
tests/module/module.c [moved from tests/import/module.c with 92% similarity]
tests/plug/Makefile [new file with mode: 0644]
tests/plug/array.c [moved from tests/import/array.c with 100% similarity]
tests/plug/array_in_var_name.c [moved from tests/import/array_in_var_name.c with 100% similarity]
tests/plug/array_in_var_name_fail.c [moved from tests/import/array_in_var_name_fail.c with 100% similarity]
tests/plug/array_incoherent_in_var_name.c [moved from tests/import/array_incoherent_in_var_name.c with 100% similarity]
tests/plug/array_invalid_in_var_name.c [moved from tests/import/array_invalid_in_var_name.c with 100% similarity]
tests/plug/callback.c [moved from tests/import/callback.c with 100% similarity]
tests/plug/callback.gwold [moved from tests/import/callback.gwold with 100% similarity]
tests/plug/callback2.gw [moved from tests/import/callback2.gw with 100% similarity]
tests/plug/class_template.c [moved from tests/import/class_template.c with 100% similarity]
tests/plug/class_template.gw [moved from tests/import/class_template.gw with 100% similarity]
tests/plug/class_template_fail.c [moved from tests/import/class_template_fail.c with 100% similarity]
tests/plug/class_template_invalid.c [moved from tests/import/class_template_invalid.c with 100% similarity]
tests/plug/compile_file.c [moved from tests/import/compile_file.c with 100% similarity]
tests/plug/compile_string.c [moved from tests/import/compile_string.c with 100% similarity]
tests/plug/coverage.c [moved from tests/import/coverage.c with 100% similarity]
tests/plug/coverage.gw [moved from tests/import/coverage.gw with 100% similarity]
tests/plug/empty_union.c [moved from tests/import/empty_union.c with 100% similarity]
tests/plug/end_class.c [moved from tests/import/end_class.c with 100% similarity]
tests/plug/enum.c [moved from tests/import/enum.c with 100% similarity]
tests/plug/enum.gw [moved from tests/import/enum.gw with 100% similarity]
tests/plug/enum_fail.c [moved from tests/import/enum_fail.c with 100% similarity]
tests/plug/enum_fail2.c [moved from tests/import/enum_fail2.c with 100% similarity]
tests/plug/enum_fail3.c [moved from tests/import/enum_fail3.c with 100% similarity]
tests/plug/extend_array.c [moved from tests/import/extend_array.c with 100% similarity]
tests/plug/extend_array.gw [moved from tests/import/extend_array.gw with 100% similarity]
tests/plug/fail_on_next_arg.c [moved from tests/import/fail_on_next_arg.c with 100% similarity]
tests/plug/fail_on_next_arg2.c [moved from tests/import/fail_on_next_arg2.c with 100% similarity]
tests/plug/fptr.c [moved from tests/import/fptr.c with 100% similarity]
tests/plug/fptr.gw [moved from tests/import/fptr.gw with 100% similarity]
tests/plug/fptr_tmpl.c [moved from tests/import/fptr_tmpl.c with 100% similarity]
tests/plug/fptr_tmpl_fail.c [moved from tests/import/fptr_tmpl_fail.c with 100% similarity]
tests/plug/func_fail.c [moved from tests/import/func_fail.c with 100% similarity]
tests/plug/func_fail2.c [moved from tests/import/func_fail2.c with 100% similarity]
tests/plug/func_fail3.c [moved from tests/import/func_fail3.c with 100% similarity]
tests/plug/func_fail4.c [moved from tests/import/func_fail4.c with 100% similarity]
tests/plug/func_subscript_not_empty.c [moved from tests/import/func_subscript_not_empty.c with 100% similarity]
tests/plug/func_tmpl.c [moved from tests/import/func_tmpl.c with 100% similarity]
tests/plug/func_tmpl.gw [moved from tests/import/func_tmpl.gw with 100% similarity]
tests/plug/func_tmpl_fail.c [moved from tests/import/func_tmpl_fail.c with 100% similarity]
tests/plug/func_too_many_arg.c [moved from tests/import/func_too_many_arg.c with 100% similarity]
tests/plug/global_func.c [moved from tests/import/global_func.c with 100% similarity]
tests/plug/global_func.gw [moved from tests/import/global_func.gw with 100% similarity]
tests/plug/global_var.c [moved from tests/import/global_var.c with 100% similarity]
tests/plug/global_var.gw [moved from tests/import/global_var.gw with 100% similarity]
tests/plug/invalid_arg.c [moved from tests/import/invalid_arg.c with 100% similarity]
tests/plug/invalid_array.c [moved from tests/import/invalid_array.c with 100% similarity]
tests/plug/invalid_func.c [moved from tests/import/invalid_func.c with 100% similarity]
tests/plug/invalid_names.c [moved from tests/import/invalid_names.c with 100% similarity]
tests/plug/invalid_names0.c [moved from tests/import/invalid_names0.c with 100% similarity]
tests/plug/invalid_names1.c [moved from tests/import/invalid_names1.c with 100% similarity]
tests/plug/invalid_names2.c [moved from tests/import/invalid_names2.c with 100% similarity]
tests/plug/invalid_names3.c [moved from tests/import/invalid_names3.c with 100% similarity]
tests/plug/invalid_type1.c [moved from tests/import/invalid_type1.c with 100% similarity]
tests/plug/invalid_type2.c [moved from tests/import/invalid_type2.c with 100% similarity]
tests/plug/invalid_type3.c [moved from tests/import/invalid_type3.c with 100% similarity]
tests/plug/map2.gw [moved from tests/import/map2.gw with 100% similarity]
tests/plug/mk_type_array.c [moved from tests/import/mk_type_array.c with 100% similarity]
tests/plug/no_import.c [moved from tests/import/no_import.c with 100% similarity]
tests/plug/not_importing.c [moved from tests/import/not_importing.c with 100% similarity]
tests/plug/op_already_imported.c [moved from tests/import/op_already_imported.c with 100% similarity]
tests/plug/op_already_imported.gw [moved from tests/import/op_already_imported.gw with 59% similarity]
tests/plug/pass.c [moved from tests/import/pass.c with 100% similarity]
tests/plug/rm_me.gw [moved from tests/import/rm_me.gw with 100% similarity]
tests/plug/specialid_emit.c [moved from tests/import/specialid_emit.c with 100% similarity]
tests/plug/specialid_emit.gw [moved from tests/import/specialid_emit.gw with 100% similarity]
tests/plug/static_string.c [moved from tests/import/static_string.c with 100% similarity]
tests/plug/static_string.gw [moved from tests/import/static_string.gw with 100% similarity]
tests/plug/str2decl.c [moved from tests/import/str2decl.c with 100% similarity]
tests/plug/str2list_fail.c [moved from tests/import/str2list_fail.c with 100% similarity]
tests/plug/template_arg.c [moved from tests/import/template_arg.c with 100% similarity]
tests/plug/test.log [new file with mode: 0644]
tests/plug/trig.c [moved from tests/import/trig.c with 100% similarity]
tests/plug/trig.gw [moved from tests/import/trig.gw with 100% similarity]
tests/plug/typedef.c [moved from tests/import/typedef.c with 100% similarity]
tests/plug/typedef.gw [moved from tests/import/typedef.gw with 100% similarity]
tests/plug/typedef_fail.c [moved from tests/import/typedef_fail.c with 100% similarity]
tests/plug/typedef_tmpl.c [moved from tests/import/typedef_tmpl.c with 100% similarity]
tests/plug/ugen_connect.c [moved from tests/import/ugen_connect.c with 100% similarity]
tests/plug/union.c [moved from tests/import/union.c with 100% similarity]
tests/plug/union.gw [moved from tests/import/union.gw with 100% similarity]
tests/plug/union_fail_exp.c [moved from tests/import/union_fail_exp.c with 100% similarity]
tests/plug/union_member.c [moved from tests/import/union_member.c with 100% similarity]
tests/plug/union_name.c [moved from tests/import/union_name.c with 100% similarity]
tests/plug/union_name.gw [moved from tests/import/union_name.gw with 100% similarity]
tests/plug/union_tmpl.c [moved from tests/import/union_tmpl.c with 100% similarity]
tests/plug/union_tmpl.gw [moved from tests/import/union_tmpl.gw with 100% similarity]
tests/plug/union_tmpl_fail.c [moved from tests/import/union_tmpl_fail.c with 100% similarity]
tests/plug/union_tmpl_fail2.c [moved from tests/import/union_tmpl_fail2.c with 100% similarity]
tests/plug/union_tmpl_fail3.c [moved from tests/import/union_tmpl_fail3.c with 100% similarity]
tests/plug/variadic.c [moved from tests/import/variadic.c with 100% similarity]
tests/plug/variadic.gw [moved from tests/import/variadic.gw with 100% similarity]
tests/plug/vm_remove.c [moved from tests/import/vm_remove.c with 100% similarity]
tests/plug/vm_remove.gw [moved from tests/import/vm_remove.gw with 100% similarity]
tests/sh/import.sh

index a5e21942a0612435fd7e30665cc839c83e566681..407d955f5f1a5f61969c19b28fb5dee2d5b306c3 100644 (file)
--- 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
 
similarity index 100%
rename from tests/import/Makefile
rename to tests/driver/Makefile
similarity index 53%
rename from tests/import/driver.c
rename to tests/driver/simple_driver.c
index 7f1628e55d13150b9ceb8e50e0a9b00b7205b489..22c2bccfdb7cd633c3a6a2f0753d7cd16774d757 100644 (file)
@@ -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 (file)
index 0000000..6327be1
--- /dev/null
@@ -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
similarity index 93%
rename from tests/import/basic_module.c
rename to tests/module/basic_module.c
index 11a37841593b90c1cebc723433cce84ffe52f050..18d05fce2f98bea5d337562a30c2e1645940f2eb 100644 (file)
@@ -4,8 +4,6 @@
 #include "vm.h"
 #include "gwion.h"
 
-GWMODSTR(basic_module)
-
 GWMODINI(basic_module) {
   puts("ini module");
   if(args) {
similarity index 79%
rename from tests/import/get_module.c
rename to tests/module/get_module.c
index d4d11e622d27ecc819a31cda23c5d7bf5984f10e..6387d7755266125d5b54705efc91f9699d6f4da0 100644 (file)
 #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__);
 }
 
similarity index 92%
rename from tests/import/module.c
rename to tests/module/module.c
index d65ee7542647a377c73576a934011ea29583e7e4..77ead7d7ae8dc74f048881871b3e15648ff4a253 100644 (file)
@@ -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 (file)
index 0000000..6327be1
--- /dev/null
@@ -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
similarity index 100%
rename from tests/import/array.c
rename to tests/plug/array.c
similarity index 100%
rename from tests/import/enum.c
rename to tests/plug/enum.c
similarity index 100%
rename from tests/import/enum.gw
rename to tests/plug/enum.gw
similarity index 100%
rename from tests/import/fptr.c
rename to tests/plug/fptr.c
similarity index 100%
rename from tests/import/fptr.gw
rename to tests/plug/fptr.gw
similarity index 100%
rename from tests/import/map2.gw
rename to tests/plug/map2.gw
similarity index 59%
rename from tests/import/op_already_imported.gw
rename to tests/plug/op_already_imported.gw
index 2bfc227d69c812ae23ed37a96028cbb925d3845f..ddbb3b6a2d8045d5734fe2c774cd61a4b31a035f 100644 (file)
@@ -1,2 +1,3 @@
 #! [contains] already imported
+#require op_already_imported
 <<< 1 >>>;
similarity index 100%
rename from tests/import/pass.c
rename to tests/plug/pass.c
similarity index 100%
rename from tests/import/rm_me.gw
rename to tests/plug/rm_me.gw
diff --git a/tests/plug/test.log b/tests/plug/test.log
new file mode 100644 (file)
index 0000000..87ce6cd
--- /dev/null
@@ -0,0 +1 @@
+op_already_imported.gw 
similarity index 100%
rename from tests/import/trig.c
rename to tests/plug/trig.c
similarity index 100%
rename from tests/import/trig.gw
rename to tests/plug/trig.gw
similarity index 100%
rename from tests/import/typedef.c
rename to tests/plug/typedef.c
similarity index 100%
rename from tests/import/union.c
rename to tests/plug/union.c
similarity index 100%
rename from tests/import/union.gw
rename to tests/plug/union.gw
index 3687b21cdb48db473a84eb135d6e74417f8973f7..b102ec59c387275d0867fc8b034491589a718292 100644 (file)
@@ -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