diff --git a/meson_options.txt b/meson_options.txt index 9b314b6..23a3a31 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,4 @@ option('build_testing', type: 'boolean', value: false) option('build_examples', type: 'boolean', value: false) -option('wren_with_cli', type: 'boolean', value: true, yield: true) option('wren_with_rand', type: 'boolean', value: false, yield: true) option('wren_with_meta', type: 'boolean', value: false, yield: true) diff --git a/subprojects/wren/find_scripts.py b/subprojects/wren/find_scripts.py new file mode 100755 index 0000000..eb0fc72 --- /dev/null +++ b/subprojects/wren/find_scripts.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +from pathlib import Path +import sys + +if len(sys.argv) < 2: + sys.stderr.write("Please specify a search directory\n") + exit(2) + +for search_path in sys.argv[1:]: + for path in Path(search_path).rglob('*.wren'): + sys.stdout.write(str(path) + "\n") diff --git a/subprojects/wren/meson.build b/subprojects/wren/meson.build index b587790..b356d86 100644 --- a/subprojects/wren/meson.build +++ b/subprojects/wren/meson.build @@ -1,6 +1,6 @@ project('wren', 'c', - version: '0.2.0', - meson_version: '>=0.49.2', + version: '0.3.0', + meson_version: '>=0.54.0', default_options: ['buildtype=release', 'c_std=c99', 'build_testing=true'], ) @@ -19,8 +19,7 @@ endif wren_incl = include_directories('wren/src/include', is_system: true) wren_pvt_incl = include_directories('wren/src/vm', 'wren/src/optional') -module_incl = include_directories('wren/src/module') -cli_incl = include_directories('wren/src/cli') +test_incl = include_directories('wren/test') threads_dep = dependency('threads') libuv_dep = c_compiler.find_library('libuv', required: true) @@ -32,21 +31,13 @@ opt_src = [ ] vm_src = [ - 'wren/src/vm/wren_debug.c', - 'wren/src/vm/wren_core.c', - 'wren/src/vm/wren_utils.c', - 'wren/src/vm/wren_vm.c', - 'wren/src/vm/wren_value.c', - 'wren/src/vm/wren_primitive.c', 'wren/src/vm/wren_compiler.c', -] - -module_src = [ - 'wren/src/module/io.c', - 'wren/src/module/timer.c', - 'wren/src/module/repl.c', - 'wren/src/module/os.c', - 'wren/src/module/scheduler.c', + 'wren/src/vm/wren_core.c', + 'wren/src/vm/wren_debug.c', + 'wren/src/vm/wren_primitive.c', + 'wren/src/vm/wren_utils.c', + 'wren/src/vm/wren_value.c', + 'wren/src/vm/wren_vm.c', ] force_static = meson.is_subproject() @@ -74,71 +65,59 @@ wren_dep = declare_dependency( link_with: wren, ) -if get_option('wren_with_cli') - cli = executable(meson.project_name(), - 'wren/src/cli/main.c', - 'wren/src/cli/path.c', - 'wren/src/cli/modules.c', - 'wren/src/cli/vm.c', - module_src, - install: not force_static, - include_directories: [cli_incl, module_incl], - dependencies: [wren_dep, libuv_dep], - c_args: ['-D_XOPEN_SOURCE=600'], - ) -endif - if get_option('build_testing') - test_api_src = [ - 'wren/test/api/main.c', - 'wren/test/api/reset_stack_after_foreign_construct.c', - 'wren/test/api/new_vm.c', - 'wren/test/api/get_variable.c', - 'wren/test/api/slots.c', - 'wren/test/api/lists.c', - 'wren/test/api/user_data.c', - 'wren/test/api/call.c', - 'wren/test/api/foreign_class.c', - 'wren/test/api/call_wren_call_root.c', - 'wren/test/api/handle.c', - 'wren/test/api/resolution.c', - 'wren/test/api/error.c', - 'wren/test/api/call_calls_foreign.c', - 'wren/test/api/reset_stack_after_call_abort.c', + fs = import('fs') + test_src = [ + 'wren/test/api/api_tests.c', 'wren/test/api/benchmark.c', + 'wren/test/api/call.c', + 'wren/test/api/call_calls_foreign.c', + 'wren/test/api/call_wren_call_root.c', + 'wren/test/api/error.c', + 'wren/test/api/foreign_class.c', + 'wren/test/api/get_variable.c', + 'wren/test/api/handle.c', + 'wren/test/api/lists.c', + 'wren/test/api/new_vm.c', + 'wren/test/api/reset_stack_after_call_abort.c', + 'wren/test/api/reset_stack_after_foreign_construct.c', + 'wren/test/api/resolution.c', + 'wren/test/api/slots.c', + 'wren/test/api/user_data.c', + 'wren/test/main.c', + 'wren/test/test.c', ] - test_unit_src = [ - 'wren/test/unit/main.c', - 'wren/test/unit/test.c', - 'wren/test/unit/path_test.c', + test_script_paths = [ + 'api', 'benchmark', 'core', 'language', 'limit', 'regression', 'unit' ] - test_api = executable('api_' + meson.project_name(), - test_api_src, - module_src, - 'wren/src/cli/path.c', - 'wren/src/cli/modules.c', - 'wren/src/cli/vm.c', + if get_option('wren_with_meta') + test_script_paths += ['meta'] + endif + + if get_option('wren_with_rand') + test_script_paths += ['random'] + endif + + test_scripts = run_command( + meson.current_source_dir() / 'find_scripts.py', + meson.current_source_dir(), + test_script_paths, + ).stdout().strip().split('\n') + + test_api = executable(meson.project_name() + '_test', + test_src, install: false, dependencies: [wren_dep, libuv_dep], - include_directories: [cli_incl, module_incl], + include_directories: [], c_args: ['-D_XOPEN_SOURCE=600'], ) - test(meson.project_name() + ' api test', test_api) - test_unit = executable('unit_' + meson.project_name(), - test_unit_src, - module_src, - 'wren/src/cli/path.c', - 'wren/src/cli/modules.c', - 'wren/src/cli/vm.c', - install: false, - include_directories: [cli_incl, module_incl], - dependencies: [wren_dep, libuv_dep], - c_args: ['-D_XOPEN_SOURCE=600'], - ) - test(meson.project_name() + ' unit test', test_unit) + foreach test_script : test_scripts + name = fs.stem(test_script) + test(meson.project_name() + ' test ' + name, test_api, args: files(test_script)) + endforeach endif if not force_static diff --git a/subprojects/wren/meson_options.txt b/subprojects/wren/meson_options.txt index 9f8f695..8bcfc38 100644 --- a/subprojects/wren/meson_options.txt +++ b/subprojects/wren/meson_options.txt @@ -1,4 +1,3 @@ option('build_testing', type: 'boolean', value: false, yield: true) -option('wren_with_cli', type: 'boolean', value: true, yield: true) option('wren_with_rand', type: 'boolean', value: false, yield: true) option('wren_with_meta', type: 'boolean', value: false, yield: true) diff --git a/subprojects/wren/wren b/subprojects/wren/wren index 6ab4abe..cd01246 160000 --- a/subprojects/wren/wren +++ b/subprojects/wren/wren @@ -1 +1 @@ -Subproject commit 6ab4abe9e3a2767ced01589e9a3d583c840f54c3 +Subproject commit cd012469976d1a9da796581cd9a9591842cb0cf8