From 0df4712658fdf36b7e38c2dc55c101ad81e4af2b Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Mon, 11 Oct 2010 12:10:23 +0200 Subject: [PATCH] msi/tests: Reduce the UI level for a couple of tests. This makes the tests run faster because native only creates restore points for installers with a basic UI level and higher. --- dlls/msi/tests/format.c | 4 ++++ dlls/msi/tests/install.c | 45 ++++++++++++++++++++++++++-------------- dlls/msi/tests/package.c | 38 +++++++++++++++++++++++++++------ 3 files changed, 66 insertions(+), 21 deletions(-) diff --git a/dlls/msi/tests/format.c b/dlls/msi/tests/format.c index c82c3c658bd..4d8e16e5890 100644 --- a/dlls/msi/tests/format.c +++ b/dlls/msi/tests/format.c @@ -2272,6 +2272,8 @@ static void test_formatrecord_tables(void) ok( r == ERROR_SUCCESS, "format record failed: %d\n", r); ok( !lstrcmp( buf, "1: " ), "Expected '1: ', got %s\n", buf ); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction(hpkg, "CostInitialize"); ok( r == ERROR_SUCCESS, "CostInitialize failed: %d\n", r); @@ -2412,6 +2414,8 @@ static void test_processmessage(void) MSIHANDLE hrec, package; UINT r; + MsiSetInternalUI(INSTALLUILEVEL_BASIC, NULL); + r = helper_createpackage( msifile, &package ); if (r == ERROR_INSTALL_PACKAGE_REJECTED) { diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index b01501553cf..3572a937454 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -727,10 +727,15 @@ static const CHAR pp_install_exec_seq_dat[] = "Action\tCondition\tSequence\n" "PublishProduct\tPUBLISH_PRODUCT=1 Or FULL=1\t6400\n" "InstallFinalize\t\t6600"; +static const CHAR pp_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n" + "s72\tS38\ts72\ti2\tS255\tS72\n" + "Component\tComponent\n" + "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\t\tmaximus\n"; + static const CHAR ppc_component_dat[] = "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n" "s72\tS38\ts72\ti2\tS255\tS72\n" "Component\tComponent\n" - "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\tUILevel=5\tmaximus\n" + "maximus\t{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}\tMSITESTDIR\t0\t\tmaximus\n" "augustus\t{5AD3C142-CEF8-490D-B569-784D80670685}\tMSITESTDIR\t1\t\taugustus\n"; static const CHAR ppc_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" @@ -2465,7 +2470,7 @@ static const msi_table spf_tables[] = static const msi_table pp_tables[] = { - ADD_TABLE(ci_component), + ADD_TABLE(pp_component), ADD_TABLE(directory), ADD_TABLE(rof_feature), ADD_TABLE(rof_feature_comp), @@ -3750,6 +3755,8 @@ static void test_MsiInstallProduct(void) if (is_wow64) access |= KEY_WOW64_64KEY; + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + /* szPackagePath is NULL */ r = MsiInstallProductA(NULL, "INSTALL=ALL"); ok(r == ERROR_INVALID_PARAMETER, @@ -4043,6 +4050,8 @@ static void test_MsiSetComponentState(void) lstrcat(path, "\\"); lstrcat(path, msifile); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiOpenPackage(path, &package); if (r == ERROR_INSTALL_PACKAGE_REJECTED) { @@ -5778,7 +5787,7 @@ static void test_publish_registeruser(void) if (is_wow64) access |= KEY_WOW64_64KEY; - MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); /* RegisterUser, per-user */ r = MsiInstallProductA(msifile, "REGISTER_USER=1"); @@ -5870,7 +5879,7 @@ static void test_publish_processcomponents(void) if (is_wow64) access |= KEY_WOW64_64KEY; - MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); /* ProcessComponents, per-user */ r = MsiInstallProductA(msifile, "PROCESS_COMPONENTS=1"); @@ -6016,7 +6025,7 @@ static void test_publish(void) create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table)); - MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); state = MsiQueryProductState("{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"); ok(state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); @@ -6549,7 +6558,7 @@ static void test_publishsourcelist(void) create_database(msifile, pp_tables, sizeof(pp_tables) / sizeof(msi_table)); - MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); r = MsiInstallProductA(msifile, NULL); if (r == ERROR_INSTALL_PACKAGE_REJECTED) @@ -7169,7 +7178,7 @@ static void test_removefiles(void) create_database(msifile, rem_tables, sizeof(rem_tables) / sizeof(msi_table)); - MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); r = MsiInstallProductA(msifile, NULL); if (r == ERROR_INSTALL_PACKAGE_REJECTED) @@ -7326,7 +7335,7 @@ static void test_movefiles(void) create_database(msifile, mov_tables, sizeof(mov_tables) / sizeof(msi_table)); - MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); /* if the source or dest property is not a full path, * windows tries to access it as a network resource @@ -8561,6 +8570,8 @@ static void test_adminimage(void) sizeof(ai_tables) / sizeof(msi_table), 100, msidbSumInfoSourceTypeAdminImage, ";1033"); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiInstallProductA(msifile, NULL); if (r == ERROR_INSTALL_PACKAGE_REJECTED) { @@ -8705,6 +8716,8 @@ static void test_shortcut(void) create_test_files(); create_database(msifile, sc_tables, sizeof(sc_tables) / sizeof(msi_table)); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiInstallProductA(msifile, NULL); if (r == ERROR_INSTALL_PACKAGE_REJECTED) { @@ -8780,6 +8793,8 @@ static void test_envvar(void) res = RegSetValueExA(env, "MSITESTVAR2", 0, REG_SZ, (const BYTE *)"0", 2); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiInstallProductA(msifile, NULL); if (r == ERROR_INSTALL_PACKAGE_REJECTED) { @@ -8888,6 +8903,8 @@ static void test_preselected(void) create_test_files(); create_database(msifile, ps_tables, sizeof(ps_tables) / sizeof(msi_table)); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiInstallProductA(msifile, "ADDLOCAL=One"); if (r == ERROR_INSTALL_PACKAGE_REJECTED) { @@ -9026,8 +9043,6 @@ static void test_allusers_prop(void) create_test_files(); create_database(msifile, aup2_tables, sizeof(aup2_tables) / sizeof(msi_table)); - MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); - /* ALLUSERS property set to 1 */ r = MsiInstallProductA(msifile, "FULL=1"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); @@ -9053,8 +9068,6 @@ static void test_allusers_prop(void) create_test_files(); create_database(msifile, aup3_tables, sizeof(aup3_tables) / sizeof(msi_table)); - MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); - /* ALLUSERS property set to 2 */ r = MsiInstallProductA(msifile, "FULL=1"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); @@ -9080,8 +9093,6 @@ static void test_allusers_prop(void) create_test_files(); create_database(msifile, aup4_tables, sizeof(aup4_tables) / sizeof(msi_table)); - MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); - /* ALLUSERS property set to 2, conditioned on ALLUSERS = 1 */ r = MsiInstallProductA(msifile, "FULL=1"); if (r == ERROR_SUCCESS) @@ -9429,6 +9440,8 @@ static void test_feature_override(void) if (is_wow64) access |= KEY_WOW64_64KEY; + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiInstallProductA(msifile, "ADDLOCAL=override"); if (r == ERROR_INSTALL_PACKAGE_REJECTED) { @@ -10646,6 +10659,8 @@ static void test_icon_table(void) create_database(msifile, icon_base_tables, sizeof(icon_base_tables) / sizeof(msi_table)); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + res = MsiOpenDatabase(msifile, MSIDBOPEN_TRANSACT, &hdb); ok(res == ERROR_SUCCESS, "failed to open db: %d\n", res); @@ -10865,7 +10880,7 @@ static void test_package_validation(void) create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0"); r = MsiInstallProductA(msifile, NULL); - ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID,, got %u\n", r); + ok(r == ERROR_INSTALL_PACKAGE_INVALID, "Expected ERROR_INSTALL_PACKAGE_INVALID, got %u\n", r); ok(!delete_pf_native("msitest\\maximus", TRUE), "file exists\n"); ok(!delete_pf_native("msitest", FALSE), "directory exists\n"); diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index 47e0da3ebd3..6cb5533f19d 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -1076,6 +1076,8 @@ static void test_settargetpath(void) } ok( r == ERROR_SUCCESS, "failed to create package %u\n", r); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction( hpkg, "CostInitialize"); ok( r == ERROR_SUCCESS, "cost init failed\n"); @@ -3329,6 +3331,8 @@ static void test_states(void) ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction( hpkg, "FileCost"); ok( r == ERROR_SUCCESS, "file cost failed\n"); @@ -3812,6 +3816,8 @@ static void test_states(void) MsiCloseHandle( hpkg ); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + /* publish the features and components */ r = MsiInstallProduct(msifile, "ADDLOCAL=one,four ADDSOURCE=two,three REMOVE=six,seven REINSTALL=eight,nine,ten"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -7779,6 +7785,8 @@ static void test_removefiles(void) r = MsiSetProperty( hpkg, "TARGETDIR", CURR_DIR ); ok( r == ERROR_SUCCESS, "set property failed\n"); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction( hpkg, "CostInitialize"); ok( r == ERROR_SUCCESS, "cost init failed\n"); @@ -7876,6 +7884,8 @@ static void test_appsearch(void) if (r != ERROR_SUCCESS) goto done; + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction( hpkg, "AppSearch" ); ok( r == ERROR_SUCCESS, "AppSearch failed: %d\n", r); @@ -8086,6 +8096,8 @@ static void test_appsearch_complocator(void) r = MsiSetPropertyA(hpkg, "SIGPROP8", "october"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction(hpkg, "AppSearch"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -8629,6 +8641,8 @@ static void test_appsearch_reglocator(void) r = package_from_db(hdb, &hpkg); ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction(hpkg, "AppSearch"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -9055,6 +9069,8 @@ static void test_appsearch_inilocator(void) } ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction(hpkg, "AppSearch"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -9358,6 +9374,8 @@ static void test_appsearch_drlocator(void) } ok(r == ERROR_SUCCESS, "Expected a valid package handle %u\n", r); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction(hpkg, "AppSearch"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -9630,6 +9648,8 @@ static void test_featureparents(void) MsiCloseHandle( hdb ); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction( hpkg, "CostInitialize"); ok( r == ERROR_SUCCESS, "cost init failed\n"); @@ -10223,6 +10243,8 @@ static void test_launchconditions(void) r = MsiSetProperty( hpkg, "X", "1" ); ok( r == ERROR_SUCCESS, "failed to set property\n" ); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + /* invalid conditions are ignored */ r = MsiDoAction( hpkg, "LaunchConditions" ); ok( r == ERROR_SUCCESS, "cost init failed\n" ); @@ -10245,8 +10267,6 @@ static void test_ccpsearch(void) DWORD size = MAX_PATH; UINT r; - MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); - hdb = create_package_db(); ok(hdb, "failed to create package database\n"); @@ -10285,6 +10305,8 @@ static void test_ccpsearch(void) MsiCloseHandle(hdb); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction(hpkg, "CCPSearch"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -10481,6 +10503,8 @@ static void test_complocator(void) set_component_path("neosodon", MSIINSTALLCONTEXT_MACHINE, "{0B499649-197A-48EF-93D2-AF1C17ED6E90}", NULL, FALSE); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction(hpkg, "AppSearch"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -10787,6 +10811,8 @@ static void test_MsiGetSourcePath(void) "Expected path to be unchanged, got \"%s\"\n", path); ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction(hpkg, "CostInitialize"); ok(r == ERROR_SUCCESS, "cost init failed\n"); @@ -11429,6 +11455,8 @@ static void test_shortlongsource(void) CreateDirectoryA("one", NULL); CreateDirectoryA("four", NULL); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction(hpkg, "CostInitialize"); ok(r == ERROR_SUCCESS, "file cost failed\n"); @@ -11750,6 +11778,8 @@ static void test_sourcedir(void) ok(!lstrcmpA(path, ""), "Expected \"\", got \"%s\"\n", path); ok(size == 0, "Expected 0, got %d\n", size); + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + r = MsiDoAction(hpkg, "CostInitialize"); ok(r == ERROR_SUCCESS, "file cost failed\n"); @@ -12168,11 +12198,9 @@ static void test_access(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); test_file_access(msifile, create_commit); - MsiCloseHandle(hdb); test_file_access(msifile, create_close); - DeleteFileA(msifile); r = MsiOpenDatabaseA(msifile, MSIDBOPEN_CREATEDIRECT, &hdb); @@ -12184,11 +12212,9 @@ static void test_access(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); test_file_access(msifile, create_commit); - MsiCloseHandle(hdb); test_file_access(msifile, create_close); - DeleteFileA(msifile); }