James Hawkins : msi: Add tests for the InstallServices action.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Oct 19 07:19:22 CDT 2006
Module: wine
Branch: master
Commit: d6632dd0fbcdcfc9e8b36d3e2dc048ae3c37cfa2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d6632dd0fbcdcfc9e8b36d3e2dc048ae3c37cfa2
Author: James Hawkins <truiken at gmail.com>
Date: Wed Oct 18 16:22:40 2006 -0700
msi: Add tests for the InstallServices action.
---
dlls/msi/tests/install.c | 58 ++++++++++++++++++++++++++++++++++++++++------
1 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 06805e3..36d9240 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -72,7 +72,8 @@ static const CHAR component_dat[] = "Com
"Three\t{010B6ADD-B27D-4EDD-9B3D-34C4F7D61684}\tCHANGEDDIR\t2\t\tthree.txt\n"
"Two\t{BF03D1A6-20DA-4A65-82F3-6CAC995915CE}\tFIRSTDIR\t2\t\ttwo.txt\n"
"dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n"
- "component\t\tTARGETDIR\t0\t1\tfile";
+ "component\t\tMSITESTDIR\t0\t1\tfile\n"
+ "service_comp\t\tMSITESTDIR\t0\t1\tservice_file";
static const CHAR directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n"
"s72\tS72\tl255\n"
@@ -93,7 +94,8 @@ static const CHAR feature_dat[] = "Featu
"One\t\tOne\tThe One Feature\t1\t3\tMSITESTDIR\t0\n"
"Three\t\tThree\tThe Three Feature\t3\t3\tCHANGEDDIR\t0\n"
"Two\t\tTwo\tThe Two Feature\t2\t3\tFIRSTDIR\t0\n"
- "feature\t\t\t\t2\t1\tTARGETDIR\t0";
+ "feature\t\t\t\t2\t1\tTARGETDIR\t0\n"
+ "service_feature\t\t\t\t2\t1\tTARGETDIR\t0";
static const CHAR feature_comp_dat[] = "Feature_\tComponent_\n"
"s38\ts72\n"
@@ -103,7 +105,8 @@ static const CHAR feature_comp_dat[] = "
"One\tOne\n"
"Three\tThree\n"
"Two\tTwo\n"
- "feature\tcomponent";
+ "feature\tcomponent\n"
+ "service_feature\tservice_comp\n";
static const CHAR file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n"
"s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n"
@@ -113,7 +116,8 @@ static const CHAR file_dat[] = "File\tCo
"one.txt\tOne\tone.txt\t1000\t\t\t0\t1\n"
"three.txt\tThree\tthree.txt\t1000\t\t\t0\t3\n"
"two.txt\tTwo\ttwo.txt\t1000\t\t\t0\t2\n"
- "file\tcomponent\tfilename\t100\t\t\t8192\t1";
+ "file\tcomponent\tfilename\t100\t\t\t8192\t1\n"
+ "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1";
static const CHAR install_exec_seq_dat[] = "Action\tCondition\tSequence\n"
"s72\tS255\tI2\n"
@@ -123,6 +127,7 @@ static const CHAR install_exec_seq_dat[]
"CostInitialize\t\t800\n"
"FileCost\t\t900\n"
"InstallFiles\t\t4000\n"
+ "InstallServices\t\t5000\n"
"InstallFinalize\t\t6600\n"
"InstallInitialize\t\t1500\n"
"InstallValidate\t\t1400\n"
@@ -160,6 +165,17 @@ static const CHAR registry_dat[] = "Regi
"regdata\t2\tSOFTWARE\\Wine\\msitest\tblah\tbad\tdangler\n"
"OrderTest\t2\tSOFTWARE\\Wine\\msitest\tOrderTestName\tOrderTestValue\tcomponent";
+static const CHAR service_install_dat[] = "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t"
+ "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n"
+ "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n"
+ "ServiceInstall\tServiceInstall\n"
+ "TestService\tTestService\tTestService\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\t";
+
+static const CHAR service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n"
+ "s72\tl255\ti2\tL255\tI2\ts72\n"
+ "ServiceControl\tServiceControl\n"
+ "ServiceControl\tTestService\t8\t\t0\tservice_comp";
+
typedef struct _msi_table
{
const CHAR *filename;
@@ -181,7 +197,9 @@ static const msi_table tables[] =
ADD_TABLE(install_exec_seq),
ADD_TABLE(media),
ADD_TABLE(property),
- ADD_TABLE(registry)
+ ADD_TABLE(registry),
+ ADD_TABLE(service_install),
+ ADD_TABLE(service_control)
};
/* cabinet definitions */
@@ -491,7 +509,8 @@ static void create_test_files(void)
create_file("five.txt");
create_cab_file("msitest.cab");
- create_file("filename");
+ create_file("msitest\\filename");
+ create_file("msitest\\service.exe");
DeleteFileA("four.txt");
DeleteFileA("five.txt");
@@ -513,12 +532,13 @@ static BOOL delete_pf(const CHAR *rel_pa
static void delete_test_files(void)
{
- DeleteFileA("filename");
DeleteFileA("msitest.msi");
DeleteFileA("msitest.cab");
DeleteFileA("msitest\\second\\three.txt");
DeleteFileA("msitest\\first\\two.txt");
DeleteFileA("msitest\\one.txt");
+ DeleteFileA("msitest\\service.exe");
+ DeleteFileA("msitest\\filename");
RemoveDirectoryA("msitest\\second");
RemoveDirectoryA("msitest\\first");
RemoveDirectoryA("msitest");
@@ -593,6 +613,27 @@ static void create_database(const CHAR *
MsiCloseHandle(db);
}
+static void check_service_is_installed(void)
+{
+ SC_HANDLE scm, service;
+ BOOL res;
+
+ scm = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+ ok(scm != NULL, "Failed to open the SC Manager\n");
+
+ service = OpenService(scm, "TestService", SC_MANAGER_ALL_ACCESS);
+ todo_wine
+ {
+ ok(service != NULL, "Failed to open TestService\n");
+ }
+
+ res = DeleteService(service);
+ todo_wine
+ {
+ ok(res, "Failed to delete TestService\n");
+ }
+}
+
static void test_MsiInstallProduct(void)
{
UINT r;
@@ -618,6 +659,8 @@ static void test_MsiInstallProduct(void)
ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n");
ok(delete_pf("msitest\\first", FALSE), "File not installed\n");
ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n");
+ ok(delete_pf("msitest\\filename", TRUE), "File not installed\n");
+ ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n");
ok(delete_pf("msitest", FALSE), "File not installed\n");
}
@@ -650,6 +693,7 @@ static void test_MsiInstallProduct(void)
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
ok(!lstrcmpA(path, "OrderTestValue"), "Expected imaname, got %s\n", path);
+ check_service_is_installed();
RegDeleteKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Wine\\msitest");
More information about the wine-cvs
mailing list