Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/tests/custom.c | 35 +++++++++++++++++++++++++++++++++++ dlls/msi/tests/custom.spec | 2 ++ dlls/msi/tests/install.c | 44 +++++++++++++++++++++++++++++++++----------- 3 files changed, 70 insertions(+), 11 deletions(-)
diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 0eedb8e..f504464 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -83,3 +83,38 @@ UINT WINAPI test_retval(MSIHANDLE hinst) sscanf(prop, "%u", &retval); return retval; } + +static void append_file(MSIHANDLE hinst, const char *filename, const char *text) +{ + DWORD size; + HANDLE file = CreateFileA(filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); + ok(hinst, file != INVALID_HANDLE_VALUE, "CreateFile failed, error %u\n", GetLastError()); + + SetFilePointer(file, 0, NULL, FILE_END); + WriteFile(file, text, strlen(text), &size, NULL); + CloseHandle(file); +} + +UINT WINAPI da_immediate(MSIHANDLE hinst) +{ + char prop[300]; + DWORD len = sizeof(prop); + + MsiGetPropertyA(hinst, "TESTPATH", prop, &len); + + append_file(hinst, prop, "one"); + + return ERROR_SUCCESS; +} + +UINT WINAPI da_deferred(MSIHANDLE hinst) +{ + char prop[300]; + DWORD len = sizeof(prop); + + MsiGetPropertyA(hinst, "CustomActionData", prop, &len); + + append_file(hinst, prop, "two"); + + return ERROR_SUCCESS; +} diff --git a/dlls/msi/tests/custom.spec b/dlls/msi/tests/custom.spec index 9d1e821..bb400ff 100644 --- a/dlls/msi/tests/custom.spec +++ b/dlls/msi/tests/custom.spec @@ -1,2 +1,4 @@ @ stdcall main_test(long) @ stdcall test_retval(long) +@ stdcall da_immediate(long) +@ stdcall da_deferred(long) diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index 55d83d4..69095cd 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -1300,12 +1300,12 @@ static const char ft_install_exec_seq_dat[] = "InstallFinalize\t\t1500\n";
static const char da_custom_action_dat[] = - "Action\tType\tSource\tTarget\tISComments\n" - "s72\ti2\tS64\tS0\tS255\n" + "Action\tType\tSource\tTarget\n" + "s72\ti2\tS64\tS0\n" "CustomAction\tAction\n" - "deferred\t1074\tCMDEXE\t/c if exist msitest (exit 0) else (exit 1)\t\n" - "immediate\t50\tCMDEXE\t/c mkdir msitest\t\n" - "cleanup\t50\tCMDEXE\t/c rmdir msitest\t\n"; + "setprop\t51\tdeferred\t[TESTPATH]\n" + "immediate\t1\tcustom.dll\tda_immediate\n" + "deferred\t1025\tcustom.dll\tda_deferred\n";
static const char da_install_exec_seq_dat[] = "Action\tCondition\tSequence\n" @@ -1315,10 +1315,10 @@ static const char da_install_exec_seq_dat[] = "FileCost\t\t300\n" "CostFinalize\t\t400\n" "InstallInitialize\t\t500\n" - "deferred\t\t600\n" - "immediate\t\t700\n" - "InstallFinalize\t\t1100\n" - "cleanup\t\t1200\n"; + "setprop\t\t600\n" + "deferred\t\t700\n" + "immediate\t\t800\n" + "InstallFinalize\t\t1100\n";
typedef struct _msi_table { @@ -6042,23 +6042,45 @@ static void test_feature_tree(void) DeleteFileA( msifile ); }
+static void check_file_matches(const char *filename, const char *text) +{ + char buffer[200]; + HANDLE file; + DWORD size; + + file = CreateFileA(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); + ReadFile(file, buffer, sizeof(buffer), &size, NULL); + ok(size == strlen(text) && !memcmp(buffer, text, size), "got %.*s\n", size, buffer); + CloseHandle(file); +} + static void test_deferred_action(void) { + char path[200], file[200], buffer[200]; UINT r;
+ GetTempPathA(sizeof(path), path); + GetTempFileNameA(path, "da", 0, file); + sprintf(buffer, "TESTPATH="%s"", file); + create_database(msifile, da_tables, sizeof(da_tables) / sizeof(da_tables[0])); + add_custom_dll();
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
- r = MsiInstallProductA(msifile, "CMDEXE="cmd.exe""); + r = MsiInstallProductA(msifile, buffer); if (r == ERROR_INSTALL_PACKAGE_REJECTED) { skip("Not enough rights to perform tests\n"); goto error; } -todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+todo_wine + check_file_matches(file, "onetwo"); + + ok(DeleteFileA(file), "Directory not created\n"); + error: DeleteFileA(msifile); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/tests/custom.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index f504464..feb8061 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -104,6 +104,10 @@ UINT WINAPI da_immediate(MSIHANDLE hinst)
append_file(hinst, prop, "one");
+ ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_SCHEDULED), "shouldn't be scheduled\n"); + ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_ROLLBACK), "shouldn't be rollback\n"); + ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_COMMIT), "shouldn't be commit\n"); + return ERROR_SUCCESS; }
@@ -111,10 +115,39 @@ UINT WINAPI da_deferred(MSIHANDLE hinst) { char prop[300]; DWORD len = sizeof(prop); + LANGID lang; + UINT r;
- MsiGetPropertyA(hinst, "CustomActionData", prop, &len); + /* Test that we were in fact deferred */ + r = MsiGetPropertyA(hinst, "CustomActionData", prop, &len); + ok(hinst, r == ERROR_SUCCESS, "got %u\n", r); + ok(hinst, prop[0], "CustomActionData was empty\n");
append_file(hinst, prop, "two");
+ /* Test available properties */ + len = sizeof(prop); + r = MsiGetPropertyA(hinst, "ProductCode", prop, &len); + ok(hinst, r == ERROR_SUCCESS, "got %u\n", r); + ok(hinst, prop[0], "got %s\n", prop); + + len = sizeof(prop); + r = MsiGetPropertyA(hinst, "UserSID", prop, &len); + ok(hinst, r == ERROR_SUCCESS, "got %u\n", r); + ok(hinst, prop[0], "got %s\n", prop); + + len = sizeof(prop); + r = MsiGetPropertyA(hinst, "TESTPATH", prop, &len); + ok(hinst, r == ERROR_SUCCESS, "got %u\n", r); + todo_wine_ok(hinst, !prop[0], "got %s\n", prop); + + /* Test modes */ + ok(hinst, MsiGetMode(hinst, MSIRUNMODE_SCHEDULED), "should be scheduled\n"); + ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_ROLLBACK), "shouldn't be rollback\n"); + ok(hinst, !MsiGetMode(hinst, MSIRUNMODE_COMMIT), "shouldn't be commit\n"); + + lang = MsiGetLanguage(hinst); + ok(hinst, lang != ERROR_INVALID_HANDLE, "MsiGetLanguage failed\n"); + return ERROR_SUCCESS; }
Signed-off-by: Hans Leidekker hans@codeweavers.com
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=36102
Your paranoid android.
=== w7u (32 bit action) === The task timed out