From 93f92d51a488749ec0dba06ff5fcd90d09472449 Mon Sep 17 00:00:00 2001 From: Andrew Nguyen Date: Fri, 9 Jul 2010 04:10:55 -0500 Subject: [PATCH] msi/tests: Skip some source tests if a required product key cannot be created. --- dlls/msi/tests/source.c | 91 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 78 insertions(+), 13 deletions(-) diff --git a/dlls/msi/tests/source.c b/dlls/msi/tests/source.c index 44721d5b954..1563c44bef9 100644 --- a/dlls/msi/tests/source.c +++ b/dlls/msi/tests/source.c @@ -896,7 +896,11 @@ static void test_MsiSourceListAddSourceEx(void) lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + goto machine_tests; + } /* product key exists */ r = pMsiSourceListAddSourceExA(prodcode, usersid, @@ -952,6 +956,7 @@ static void test_MsiSourceListAddSourceEx(void) /* MSIINSTALLCONTEXT_MACHINE */ +machine_tests: /* szUserSid must be NULL for MSIINSTALLCONTEXT_MACHINE */ r = pMsiSourceListAddSourceExA(prodcode, usersid, MSIINSTALLCONTEXT_MACHINE, @@ -967,7 +972,12 @@ static void test_MsiSourceListAddSourceEx(void) lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + LocalFree(usersid); + return; + } /* product key exists */ r = pMsiSourceListAddSourceExA(prodcode, NULL, @@ -1358,7 +1368,11 @@ static void test_MsiSourceListEnumSources(void) lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + goto machine_tests; + } /* user product key exists */ size = MAX_PATH; @@ -1469,6 +1483,7 @@ static void test_MsiSourceListEnumSources(void) /* MSIINSTALLCONTEXT_MACHINE */ +machine_tests: /* szUserSid is non-NULL */ size = MAX_PATH; lstrcpyA(value, "aaa"); @@ -1493,7 +1508,12 @@ static void test_MsiSourceListEnumSources(void) lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + LocalFree(usersid); + return; + } /* user product key exists */ size = MAX_PATH; @@ -1938,7 +1958,11 @@ static void test_MsiSourceListSetInfo(void) lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + goto machine_tests; + } /* user product key exists */ r = pMsiSourceListSetInfoA(prodcode, NULL, @@ -1971,11 +1995,17 @@ static void test_MsiSourceListSetInfo(void) /* MSIINSTALLCONTEXT_MACHINE */ +machine_tests: lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\"); lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + LocalFree(usersid); + return; + } /* user product key exists */ r = pMsiSourceListSetInfoA(prodcode, NULL, @@ -2234,7 +2264,11 @@ static void test_MsiSourceListAddMediaDisk(void) lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + goto machine_tests; + } /* user product key exists */ r = pMsiSourceListAddMediaDiskA(prodcode, usersid, @@ -2268,11 +2302,17 @@ static void test_MsiSourceListAddMediaDisk(void) /* MSIINSTALLCONTEXT_MACHINE */ +machine_tests: lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\"); lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + LocalFree(usersid); + return; + } /* machine product key exists */ r = pMsiSourceListAddMediaDiskA(prodcode, NULL, @@ -2939,7 +2979,11 @@ static void test_MsiSourceListEnumMediaDisks(void) lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + goto machine_tests; + } /* user product key exists */ r = pMsiSourceListEnumMediaDisksA(prodcode, usersid, MSIINSTALLCONTEXT_USERMANAGED, @@ -3017,11 +3061,17 @@ static void test_MsiSourceListEnumMediaDisks(void) /* MSIINSTALLCONTEXT_MACHINE */ +machine_tests: lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\"); lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + LocalFree(usersid); + return; + } /* machine product key exists */ r = pMsiSourceListEnumMediaDisksA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, @@ -3201,7 +3251,11 @@ static void test_MsiSourceListAddSource(void) lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &userkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + goto userunmanaged_tests; + } /* user product key exists */ r = pMsiSourceListAddSourceA(prodcode, username, 0, "source"); @@ -3292,6 +3346,7 @@ static void test_MsiSourceListAddSource(void) /* MSIINSTALLCONTEXT_USERUNMANAGED */ +userunmanaged_tests: r = pMsiSourceListAddSourceA(prodcode, username, 0, "source"); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); @@ -3299,7 +3354,11 @@ static void test_MsiSourceListAddSource(void) lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &userkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + goto machine_tests; + } /* user product key exists */ r = pMsiSourceListAddSourceA(prodcode, username, 0, "source"); @@ -3328,6 +3387,7 @@ static void test_MsiSourceListAddSource(void) /* MSIINSTALLCONTEXT_MACHINE */ +machine_tests: r = pMsiSourceListAddSourceA(prodcode, NULL, 0, "source"); ok(r == ERROR_UNKNOWN_PRODUCT, "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); @@ -3335,7 +3395,12 @@ static void test_MsiSourceListAddSource(void) lstrcatA(keypath, prod_squashed); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + if (res != ERROR_SUCCESS) + { + skip("Product key creation failed with error code %u\n", res); + LocalFree(usersid); + return; + } /* machine product key exists */ r = pMsiSourceListAddSourceA(prodcode, NULL, 0, "source"); -- 2.11.4.GIT