From 1459a0105d6124f7eb58c2885500bf678068abf1 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 9 Apr 2019 09:48:23 +0200 Subject: [PATCH] makefiles: Default to building test modules as PE. Signed-off-by: Alexandre Julliard --- Makefile.in | 1 - dlls/gameux/tests/test.gdf.xml | 2 +- dlls/imagehlp/tests/integrity.c | 2 +- dlls/ntdll/tests/info.c | 8 ---- dlls/shell32/tests/shlexec.c | 6 +-- tools/makedep.c | 80 +++++++-------------------------- tools/runtest | 10 +++-- 7 files changed, 28 insertions(+), 81 deletions(-) diff --git a/Makefile.in b/Makefile.in index b916a69761a..ffdd61c0142 100644 --- a/Makefile.in +++ b/Makefile.in @@ -5,7 +5,6 @@ # distclean: also remove all files created by configure # test: run tests # testclean: clean test results to force running all tests again -# crosstest: build tests as native windows applications (requires MinGW) # install-lib: install libraries needed to run applications # install-dev: install development environment # install: install everything diff --git a/dlls/gameux/tests/test.gdf.xml b/dlls/gameux/tests/test.gdf.xml index c8959fcd532..08fcce8ac65 100644 --- a/dlls/gameux/tests/test.gdf.xml +++ b/dlls/gameux/tests/test.gdf.xml @@ -31,7 +31,7 @@ xmlns="urn:schemas-microsoft-com:GameDescription.v1"> - + diff --git a/dlls/imagehlp/tests/integrity.c b/dlls/imagehlp/tests/integrity.c index 4617c71fbb8..a5648ad159d 100644 --- a/dlls/imagehlp/tests/integrity.c +++ b/dlls/imagehlp/tests/integrity.c @@ -378,7 +378,7 @@ static void test_pe_checksum(void) ret = pCheckSumMappedFile(modinfo.lpBaseOfDll, 0, &checksum_orig, &checksum_new); ok(!ret || (ret == nt_header), "Expected CheckSumMappedFile to fail, got %p\n", ret); ok((checksum_orig == 0xdeadbeef) || (checksum_orig == checksum_correct), "Expected %x, got %x\n", checksum_correct, checksum_orig); - todo_wine ok((checksum_new == 0xdeadbeef) || (checksum_new != 0 && checksum_new != 0xdeadbeef), "Got unexpected value %x\n", checksum_new); + ok((checksum_new == 0xdeadbeef) || (checksum_new != 0 && checksum_new != 0xdeadbeef), "Got unexpected value %x\n", checksum_new); checksum_orig = checksum_new = 0xdeadbeef; ret = pCheckSumMappedFile((char *)modinfo.lpBaseOfDll + 1, 0, diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index 5f27d8bb694..c278c8d0e5d 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -60,12 +60,6 @@ static DWORD one_before_last_pid = 0; #define FIRM 0x4649524D #define RSMB 0x52534D42 -#ifdef linux -static const int firmware_todo = 0; -#else -static const int firmware_todo = 1; -#endif - static BOOL InitFunctionPtrs(void) { /* All needed functions are NT based, so using GetModuleHandle is a good check */ @@ -873,7 +867,6 @@ static void test_query_firmware(void) sfti->Action = SystemFirmwareTable_Get; status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, min_sfti_len, &len1); -todo_wine_if(firmware_todo) ok(status == STATUS_BUFFER_TOO_SMALL, "Expected STATUS_BUFFER_TOO_SMALL, got %08x\n", status); ok(len1 >= min_sfti_len, "Expected length >= %u, got %u\n", min_sfti_len, len1); ok(sfti->TableBufferLength == len1 - min_sfti_len, @@ -883,7 +876,6 @@ todo_wine_if(firmware_todo) ok(!!sfti, "Failed to allocate memory\n"); status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, len1, &len2); -todo_wine_if(firmware_todo) ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); ok(len2 == len1, "Expected length %u, got %u\n", len1, len2); ok(sfti->TableBufferLength == len1 - min_sfti_len, diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c index 9dff9f81e6b..dbf2f88a373 100644 --- a/dlls/shell32/tests/shlexec.c +++ b/dlls/shell32/tests/shlexec.c @@ -2829,7 +2829,7 @@ static void test_directory(void) okShell(rc > 32, "returned %lu\n", rc); okChildInt("argcA", 4); okChildString("argvA3", "Exec"); - todo_wine okChildPath("longPath", path); + okChildPath("longPath", path); SetCurrentDirectoryA(curdir); rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI, @@ -2842,7 +2842,7 @@ static void test_directory(void) okShell(rc > 32, "returned %lu\n", rc); okChildInt("argcA", 4); okChildString("argvA3", "Exec"); - todo_wine okChildPath("longPath", path); + okChildPath("longPath", path); /* Specify it through an environment variable */ rc=shell_execute_ex(SEE_MASK_NOZONECHECKS|SEE_MASK_FLAG_NO_UI, @@ -2854,7 +2854,7 @@ static void test_directory(void) okShell(rc > 32, "returned %lu\n", rc); okChildInt("argcA", 4); okChildString("argvA3", "Exec"); - todo_wine okChildPath("longPath", path); + okChildPath("longPath", path); /* Not a colon-separated directory list */ sprintf(dirpath, "%s:%s", curdir, tmpdir); diff --git a/tools/makedep.c b/tools/makedep.c index c1cbf78aa00..307b7a39c32 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -2922,7 +2922,6 @@ static void output_source_default( struct makefile *make, struct incl_file *sour (source->file->flags & FLAG_C_IMPLIB) || (make->module && make->staticlib))); int need_obj = (!need_cross || - (make->testdll && !is_dll_src) || (source->file->flags & FLAG_C_IMPLIB) || (make->module && make->staticlib)); @@ -2973,7 +2972,7 @@ static void output_source_default( struct makefile *make, struct incl_file *sour output( "\t%s $(RUNTESTFLAGS) -T %s -M %s -p %s%s %s && touch $@\n", top_src_dir_path( make, "tools/runtest" ), top_obj_dir_path( make, "" ), make->testdll, replace_extension( make->testdll, ".dll", "_test.exe" ), - dll_ext, obj ); + crosstarget ? "" : dll_ext, obj ); } } if (need_obj) output_filename( strmake( "%s.o", obj_dir_path( make, obj ))); @@ -3249,32 +3248,32 @@ static void output_test_module( struct makefile *make ) char *stripped = replace_extension( make->testdll, ".dll", "_test-stripped.exe" ); char *testres = replace_extension( make->testdll, ".dll", "_test.res" ); struct strarray dep_libs = empty_strarray; - struct strarray all_libs = add_import_libs( make, &dep_libs, make->imports, 0 ); + struct strarray all_libs = add_import_libs( make, &dep_libs, make->imports, !!crosstarget ); int parent_disabled = 0; + const char *ext = crosstarget ? "" : dll_ext; - add_import_libs( make, &dep_libs, get_default_imports( make ), 0 ); /* dependencies only */ + add_import_libs( make, &dep_libs, get_default_imports( make ), !!crosstarget ); /* dependencies only */ strarray_addall( &all_libs, libs ); - strarray_add( &make->all_targets, strmake( "%s%s", testmodule, dll_ext )); - strarray_add( &make->clean_files, strmake( "%s%s", stripped, dll_ext )); - output( "%s%s:\n", obj_dir_path( make, testmodule ), dll_ext ); - output_winegcc_command( make, 0 ); + strarray_add( &make->all_targets, strmake( "%s%s", testmodule, ext )); + strarray_add( &make->clean_files, strmake( "%s%s", stripped, ext )); + output( "%s%s:\n", obj_dir_path( make, testmodule ), ext ); + output_winegcc_command( make, !!crosstarget ); output_filenames( make->appmode ); - output_filenames_obj_dir( make, make->object_files ); + output_filenames_obj_dir( make, crosstarget ? make->crossobj_files : make->object_files ); output_filenames( all_libs ); output_filename( "$(LDFLAGS)" ); output( "\n" ); - output( "%s%s:\n", obj_dir_path( make, stripped ), dll_ext ); - output_winegcc_command( make, 0 ); + output( "%s%s:\n", obj_dir_path( make, stripped ), ext ); + output_winegcc_command( make, !!crosstarget ); output_filename( "-s" ); output_filename( strmake( "-Wb,-F,%s", testmodule )); output_filenames( make->appmode ); - output_filenames_obj_dir( make, make->object_files ); + output_filenames_obj_dir( make, crosstarget ? make->crossobj_files : make->object_files ); output_filenames( all_libs ); output_filename( "$(LDFLAGS)" ); output( "\n" ); - output( "%s%s %s%s:", obj_dir_path( make, testmodule ), dll_ext, - obj_dir_path( make, stripped ), dll_ext ); - output_filenames_obj_dir( make, make->object_files ); + output( "%s%s %s%s:", obj_dir_path( make, testmodule ), ext, obj_dir_path( make, stripped ), ext ); + output_filenames_obj_dir( make, crosstarget ? make->crossobj_files : make->object_files ); output_filenames( dep_libs ); output_filename( tools_path( make, "winebuild" )); output_filename( tools_path( make, "winegcc" )); @@ -3283,37 +3282,9 @@ static void output_test_module( struct makefile *make ) if (!make->disabled && !strarray_exists( &disabled_dirs, "programs/winetest" )) output( "all: %s/%s\n", top_obj_dir_path( make, "programs/winetest" ), testres ); output( "%s/%s: %s%s\n", top_obj_dir_path( make, "programs/winetest" ), testres, - obj_dir_path( make, stripped ), dll_ext ); + obj_dir_path( make, stripped ), ext ); output( "\techo \"%s TESTRES \\\"%s%s\\\"\" | %s -o $@\n", - testmodule, obj_dir_path( make, stripped ), dll_ext, tools_path( make, "wrc" )); - - if (crosstarget) - { - char *crosstest = replace_extension( make->testdll, ".dll", "_crosstest.exe" ); - - dep_libs = empty_strarray; - all_libs = add_import_libs( make, &dep_libs, make->imports, 1 ); - add_import_libs( make, &dep_libs, get_default_imports( make ), 1 ); /* dependencies only */ - strarray_addall( &all_libs, libs ); - strarray_add( &make->clean_files, crosstest ); - output( "%s:", obj_dir_path( make, crosstest )); - output_filenames_obj_dir( make, make->crossobj_files ); - output_filenames( dep_libs ); - output_filename( tools_path( make, "winebuild" )); - output_filename( tools_path( make, "winegcc" )); - output( "\n" ); - output_winegcc_command( make, 1 ); - output_filenames_obj_dir( make, make->crossobj_files ); - output_filenames( all_libs ); - output_filename( "$(LDFLAGS)" ); - output( "\n" ); - if (!make->disabled) - { - output( "%s: %s\n", obj_dir_path( make, "crosstest" ), obj_dir_path( make, crosstest )); - strarray_add( &make->phony_targets, obj_dir_path( make, "crosstest" )); - if (make->obj_dir) output( "crosstest: %s\n", obj_dir_path( make, "crosstest" )); - } - } + testmodule, obj_dir_path( make, stripped ), ext, tools_path( make, "wrc" )); if (strendswith( make->base_dir, "/tests" )) { @@ -3322,7 +3293,7 @@ static void output_test_module( struct makefile *make ) parent_disabled = strarray_exists( &disabled_dirs, dir ); } output_filenames_obj_dir( make, make->ok_files ); - output( ": %s%s ../%s%s\n", testmodule, dll_ext, make->testdll, dll_ext ); + output( ": %s%s ../%s%s\n", testmodule, ext, make->testdll, dll_ext ); output( "check test:" ); if (!make->disabled && !parent_disabled) output_filenames_obj_dir( make, make->ok_files ); output( "\n" ); @@ -3423,7 +3394,6 @@ static void output_subdirs( struct makefile *make ) struct strarray tools_deps = empty_strarray; struct strarray tooldeps_deps = empty_strarray; struct strarray winetest_deps = empty_strarray; - struct strarray crosstest_deps = empty_strarray; unsigned int i, j; strarray_addall( &distclean_files, make->distclean_files ); @@ -3511,15 +3481,6 @@ static void output_subdirs( struct makefile *make ) output( "\t@cd %s && $(MAKE) test\n", subdir ); strarray_add( &winetest_deps, subdir ); strarray_add( &builddeps_deps, subdir ); - if (crosstarget) - { - char *target = base_dir_path( submake, "crosstest" ); - output( "crosstest: %s\n", target ); - output( "%s: dummy\n", target ); - output( "\t@cd %s && $(MAKE) crosstest\n", subdir ); - strarray_add( &crosstest_deps, target ); - strarray_add( &builddeps_deps, target ); - } } else { @@ -3592,12 +3553,6 @@ static void output_subdirs( struct makefile *make ) strarray_add( &make->phony_targets, "check" ); strarray_add( &make->phony_targets, "test" ); } - output( "crosstest:" ); - output_filenames( crosstest_deps ); - output( "\n" ); - if (!crosstest_deps.count) - output( "\t@echo \"crosstest is not supported (mingw not installed?)\" && false\n" ); - strarray_add( &make->phony_targets, "crosstest" ); output( "clean::\n"); output_rm_filenames( clean_files ); @@ -3617,7 +3572,6 @@ static void output_subdirs( struct makefile *make ) strarray_add( &make->phony_targets, "distclean" ); strarray_add( &make->phony_targets, "testclean" ); strarray_addall( &make->phony_targets, all_deps ); - strarray_addall( &make->phony_targets, crosstest_deps ); strarray_addall( &make->clean_files, symlinks ); strarray_addall( &build_deps, tools_deps ); diff --git a/tools/runtest b/tools/runtest index 79bd2f7f773..3299d6135c8 100755 --- a/tools/runtest +++ b/tools/runtest @@ -94,20 +94,22 @@ if [ -z "$program" ]; then case $working_path in */dlls/*/tests) parent_path=`dirname "$working_path"` - program=`basename "$parent_path"`_test.exe.so + program=`basename "$parent_path"`_test.exe ;; */dlls/*) - program=tests/`basename "$working_path"`_test.exe.so + program=tests/`basename "$working_path"`_test.exe ;; */programs/*/tests) parent_path=`dirname "$working_path"` - program=`basename "$parent_path"`.exe_test.exe.so + program=`basename "$parent_path"`.exe_test.exe ;; */programs/*) - program=tests/`basename "$working_path"`.exe_test.exe.so + program=tests/`basename "$working_path"`.exe_test.exe ;; esac + test -f "$program" || program="$program".so fi + if [ ! -f "$program" ]; then echo "Can't find the test program, use the -p argument to specify one" 1>&2 usage