diff --git a/posix/BUILD b/posix/BUILD index 77c780e..69ee1bf 100644 --- a/posix/BUILD +++ b/posix/BUILD @@ -12,10 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -Alias('posix', 'posix/ueforth') Importation('gen/posix_boot.h', '$src/posix/posix_boot.fs', name='boot') Compile('posix/ueforth', '$src/posix/main.c', implicit=['gen/posix_boot.h']) +Alias('posix', ' '.join([ + ForthTest('tests/posix_all_tests.out', 'posix/ueforth', '$src/common/all_tests.fs'), +])) + OneShot('install', 'sudo cp posix/ueforth /usr/bin/ueforth', 'posix/ueforth', pool='console') diff --git a/tools/configure.py b/tools/configure.py index eda5a28..5a8d6a6 100755 --- a/tools/configure.py +++ b/tools/configure.py @@ -222,6 +222,12 @@ rule oneshot description = ONESHOT command = echo oneshot +rule forth_test + description = FORTH_TEST + depfile = $out.d + deps = gcc + command = $src/tools/importation.py -i $test -o $out --depsout $depfile --no-out && $interp $forth $test >$out + rule clean description = CLEAN command = ninja -t clean @@ -355,6 +361,17 @@ def OneShot(target, command, source, pool=None): return target +def ForthTest(target, forth, test, interp='', pool=None): + global output + output += f'build {target}: forth_test {forth} {test}\n' + output += f' forth = {forth}\n' + output += f' test = {test}\n' + output += f' interp = {interp}\n' + if pool: + output += f' pool = {pool}\n' + return target + + def Default(target): global output output += f'default {target}\n' diff --git a/windows/BUILD b/windows/BUILD index f9061c7..e9ef4c1 100644 --- a/windows/BUILD +++ b/windows/BUILD @@ -21,14 +21,20 @@ Importation('gen/windows_boot_extra.h', '$src/windows/windows_boot_extra.fs', header_mode='win', name='boot_extra') # Compile Win32. -Alias('win32', 'windows/uEf32.exe') +Alias('win32', ' '.join([ + ForthTest('tests/win32_all_tests.out', 'windows/uEf32.exe', '$src/common/all_tests.fs', + interp='wine', pool='console'), +])) CompileW32('windows/uEf32.obj', '$src/windows/main.c', implicit=['gen/windows_boot.h', 'gen/windows_boot_extra.h']) LinkW32('windows/uEf32.exe', ' '.join(['windows/uEf32.obj', 'resources/ueforth_res32.res'])) # Compile Win64. -Alias('win64', 'windows/uEf64.exe') +Alias('win64', ' '.join([ + ForthTest('tests/win64_all_tests.out', 'windows/uEf64.exe', '$src/common/all_tests.fs', + interp='wine', pool='console'), +])) CompileW64('windows/uEf64.obj', '$src/windows/main.c', implicit=['gen/windows_boot.h', 'gen/windows_boot_extra.h']) LinkW64('windows/uEf64.exe',