mirror of
https://github.com/reactos/wine.git
synced 2024-12-14 07:08:41 +00:00
qmgr/tests: Do an early check to skip all tests.
This commit is contained in:
parent
76c3f0cffb
commit
2245acf75a
@ -108,11 +108,6 @@ static void test_GetCount(void)
|
||||
|
||||
hres = IEnumBackgroundCopyFiles_GetCount(test_enumFiles, &fileCount);
|
||||
ok(hres == S_OK, "GetCount failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to get count from test_enumFiles.\n");
|
||||
return;
|
||||
}
|
||||
ok(fileCount == test_fileCount, "Got incorrect count\n");
|
||||
}
|
||||
|
||||
@ -128,11 +123,6 @@ static void test_Next_walkListNull(void)
|
||||
{
|
||||
hres = IEnumBackgroundCopyFiles_Next(test_enumFiles, 1, &file, NULL);
|
||||
ok(hres == S_OK, "Next failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to get file from test_enumFiles\n");
|
||||
return;
|
||||
}
|
||||
IBackgroundCopyFile_Release(file);
|
||||
}
|
||||
|
||||
@ -156,11 +146,6 @@ static void test_Next_walkList_1(void)
|
||||
fetched = 0;
|
||||
hres = IEnumBackgroundCopyFiles_Next(test_enumFiles, 1, &file, &fetched);
|
||||
ok(hres == S_OK, "Next failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to get file from test_enumFiles\n");
|
||||
return;
|
||||
}
|
||||
ok(fetched == 1, "Next returned the incorrect number of files: %08x\n", hres);
|
||||
ok(file != NULL, "Next returned NULL\n");
|
||||
if (file)
|
||||
@ -188,11 +173,6 @@ static void test_Next_walkList_2(void)
|
||||
fetched = 0;
|
||||
hres = IEnumBackgroundCopyFiles_Next(test_enumFiles, test_fileCount, files, &fetched);
|
||||
ok(hres == S_OK, "Next failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to get file from test_enumFiles\n");
|
||||
return;
|
||||
}
|
||||
ok(fetched == test_fileCount, "Next returned the incorrect number of files: %08x\n", hres);
|
||||
|
||||
for (i = 0; i < test_fileCount; i++)
|
||||
@ -224,11 +204,6 @@ static void test_Skip_walkList(void)
|
||||
{
|
||||
hres = IEnumBackgroundCopyFiles_Skip(test_enumFiles, 1);
|
||||
ok(hres == S_OK, "Skip failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to properly Skip files\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
hres = IEnumBackgroundCopyFiles_Skip(test_enumFiles, 1);
|
||||
@ -253,11 +228,6 @@ static void test_Reset(void)
|
||||
ok(hres == S_OK, "Skip failed: %08x\n", hres);
|
||||
hres = IEnumBackgroundCopyFiles_Reset(test_enumFiles);
|
||||
ok(hres == S_OK, "Reset failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to Reset enumerator\n");
|
||||
return;
|
||||
}
|
||||
hres = IEnumBackgroundCopyFiles_Skip(test_enumFiles, test_fileCount);
|
||||
ok(hres == S_OK, "Reset failed: %08x\n", hres);
|
||||
}
|
||||
@ -278,14 +248,15 @@ START_TEST(enum_files)
|
||||
0
|
||||
};
|
||||
const test_t *test;
|
||||
int i;
|
||||
|
||||
CoInitialize(NULL);
|
||||
for (test = tests; *test; ++test)
|
||||
for (test = tests, i = 0; *test; ++test, ++i)
|
||||
{
|
||||
/* Keep state separate between tests. */
|
||||
if (!setup())
|
||||
{
|
||||
skip("Unable to setup test\n");
|
||||
ok(0, "tests:%d: Unable to setup test\n", i);
|
||||
break;
|
||||
}
|
||||
(*test)();
|
||||
|
@ -113,19 +113,9 @@ static void test_GetCount(void)
|
||||
|
||||
hres = IEnumBackgroundCopyJobs_GetCount(test_enumJobsA, &jobCountA);
|
||||
ok(hres == S_OK, "GetCount failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Couldn't get job count\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hres = IEnumBackgroundCopyJobs_GetCount(test_enumJobsB, &jobCountB);
|
||||
ok(hres == S_OK, "GetCount failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Couldn't get job count\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ok(jobCountB == jobCountA + 1, "Got incorrect count\n");
|
||||
}
|
||||
@ -142,11 +132,6 @@ static void test_Next_walkListNull(void)
|
||||
{
|
||||
hres = IEnumBackgroundCopyJobs_Next(test_enumJobsB, 1, &job, NULL);
|
||||
ok(hres == S_OK, "Next failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to get job from Next\n");
|
||||
return;
|
||||
}
|
||||
IBackgroundCopyJob_Release(job);
|
||||
}
|
||||
|
||||
@ -169,11 +154,6 @@ static void test_Next_walkList_1(void)
|
||||
fetched = 0;
|
||||
hres = IEnumBackgroundCopyJobs_Next(test_enumJobsB, 1, &job, &fetched);
|
||||
ok(hres == S_OK, "Next failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to get job from Next\n");
|
||||
return;
|
||||
}
|
||||
ok(fetched == 1, "Next returned the incorrect number of jobs: %08x\n", hres);
|
||||
IBackgroundCopyJob_Release(job);
|
||||
}
|
||||
@ -194,24 +174,12 @@ static void test_Next_walkList_2(void)
|
||||
ULONG i;
|
||||
|
||||
jobs = HeapAlloc(GetProcessHeap(), 0, test_jobCountB * sizeof *jobs);
|
||||
if (!jobs)
|
||||
{
|
||||
skip("Couldn't allocate memory\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < test_jobCountB; i++)
|
||||
jobs[i] = NULL;
|
||||
|
||||
fetched = 0;
|
||||
hres = IEnumBackgroundCopyJobs_Next(test_enumJobsB, test_jobCountB, jobs, &fetched);
|
||||
ok(hres == S_OK, "Next failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to get file from test_enumJobs\n");
|
||||
HeapFree(GetProcessHeap(), 0, jobs);
|
||||
return;
|
||||
}
|
||||
ok(fetched == test_jobCountB, "Next returned the incorrect number of jobs: %08x\n", hres);
|
||||
|
||||
for (i = 0; i < test_jobCountB; i++)
|
||||
@ -245,11 +213,6 @@ static void test_Skip_walkList(void)
|
||||
{
|
||||
hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, 1);
|
||||
ok(hres == S_OK, "Skip failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to properly Skip jobs\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, 1);
|
||||
@ -272,19 +235,9 @@ static void test_Reset(void)
|
||||
|
||||
hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, test_jobCountB);
|
||||
ok(hres == S_OK, "Skip failed: %08x\n", hres);
|
||||
if (hres != S_OK)
|
||||
{
|
||||
skip("Skip failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hres = IEnumBackgroundCopyJobs_Reset(test_enumJobsB);
|
||||
ok(hres == S_OK, "Reset failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to Reset enumerator\n");
|
||||
return;
|
||||
}
|
||||
|
||||
hres = IEnumBackgroundCopyJobs_Skip(test_enumJobsB, test_jobCountB);
|
||||
ok(hres == S_OK, "Reset failed: %08x\n", hres);
|
||||
@ -306,15 +259,16 @@ START_TEST(enum_jobs)
|
||||
0
|
||||
};
|
||||
const test_t *test;
|
||||
int i;
|
||||
|
||||
CoInitialize(NULL);
|
||||
for (test = tests; *test; ++test)
|
||||
for (test = tests, i = 0; *test; ++test, ++i)
|
||||
{
|
||||
/* Keep state separate between tests */
|
||||
if (!setup())
|
||||
{
|
||||
teardown();
|
||||
skip("Unable to setup test\n");
|
||||
ok(0, "tests:%d: Unable to setup test\n", i);
|
||||
break;
|
||||
}
|
||||
(*test)();
|
||||
|
@ -40,6 +40,26 @@ static IBackgroundCopyManager *test_manager;
|
||||
static IEnumBackgroundCopyFiles *test_enumFiles;
|
||||
static IBackgroundCopyFile *test_file;
|
||||
|
||||
static HRESULT test_create_manager(void)
|
||||
{
|
||||
HRESULT hres;
|
||||
IBackgroundCopyManager *manager = NULL;
|
||||
|
||||
/* Creating BITS instance */
|
||||
hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL, CLSCTX_LOCAL_SERVER,
|
||||
&IID_IBackgroundCopyManager, (void **) &manager);
|
||||
|
||||
if(hres == HRESULT_FROM_WIN32(ERROR_SERVICE_DISABLED)) {
|
||||
win_skip("Needed Service is disabled\n");
|
||||
return hres;
|
||||
}
|
||||
|
||||
if (hres == S_OK)
|
||||
IBackgroundCopyManager_Release(manager);
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
/* Helper function to add a file to a job. The helper function takes base
|
||||
file name and creates properly formed path and URL strings for creation of
|
||||
the file. */
|
||||
@ -119,11 +139,6 @@ static void test_GetRemoteName(void)
|
||||
|
||||
hres = IBackgroundCopyFile_GetRemoteName(test_file, &name);
|
||||
ok(hres == S_OK, "GetRemoteName failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to get remote name of test_file.\n");
|
||||
return;
|
||||
}
|
||||
ok(lstrcmpW(name, test_remoteUrl) == 0, "Got incorrect remote name\n");
|
||||
CoTaskMemFree(name);
|
||||
}
|
||||
@ -136,11 +151,6 @@ static void test_GetLocalName(void)
|
||||
|
||||
hres = IBackgroundCopyFile_GetLocalName(test_file, &name);
|
||||
ok(hres == S_OK, "GetLocalName failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to get local name of test_file.\n");
|
||||
return;
|
||||
}
|
||||
ok(lstrcmpW(name, test_localFile) == 0, "Got incorrect local name\n");
|
||||
CoTaskMemFree(name);
|
||||
}
|
||||
@ -153,11 +163,6 @@ static void test_GetProgress_PreTransfer(void)
|
||||
|
||||
hres = IBackgroundCopyFile_GetProgress(test_file, &progress);
|
||||
ok(hres == S_OK, "GetProgress failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to get progress of test_file.\n");
|
||||
return;
|
||||
}
|
||||
ok(progress.BytesTotal == BG_SIZE_UNKNOWN, "Got incorrect total size: %x%08x\n",
|
||||
(DWORD)(progress.BytesTotal >> 32), (DWORD)progress.BytesTotal);
|
||||
ok(progress.BytesTransferred == 0, "Got incorrect number of transferred bytes: %x%08x\n",
|
||||
@ -176,14 +181,23 @@ START_TEST(file)
|
||||
0
|
||||
};
|
||||
const test_t *test;
|
||||
int i;
|
||||
|
||||
CoInitialize(NULL);
|
||||
for (test = tests; *test; ++test)
|
||||
|
||||
if (FAILED(test_create_manager()))
|
||||
{
|
||||
CoUninitialize();
|
||||
win_skip("Failed to create Manager instance, skipping tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (test = tests, i = 0; *test; ++test, ++i)
|
||||
{
|
||||
/* Keep state separate between tests. */
|
||||
if (!setup())
|
||||
{
|
||||
skip("Unable to setup test\n");
|
||||
ok(0, "tests:%d: Unable to setup test\n", i);
|
||||
break;
|
||||
}
|
||||
(*test)();
|
||||
|
@ -37,7 +37,27 @@ static IBackgroundCopyJob *test_job;
|
||||
static GUID test_jobId;
|
||||
static BG_JOB_TYPE test_type;
|
||||
|
||||
static VOID init_paths(void)
|
||||
static HRESULT test_create_manager(void)
|
||||
{
|
||||
HRESULT hres;
|
||||
IBackgroundCopyManager *manager = NULL;
|
||||
|
||||
/* Creating BITS instance */
|
||||
hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL, CLSCTX_LOCAL_SERVER,
|
||||
&IID_IBackgroundCopyManager, (void **) &manager);
|
||||
|
||||
if(hres == HRESULT_FROM_WIN32(ERROR_SERVICE_DISABLED)) {
|
||||
win_skip("Needed Service is disabled\n");
|
||||
return hres;
|
||||
}
|
||||
|
||||
if (hres == S_OK)
|
||||
IBackgroundCopyManager_Release(manager);
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
static void init_paths(void)
|
||||
{
|
||||
WCHAR tmpDir[MAX_PATH];
|
||||
WCHAR prefix[] = {'q', 'm', 'g', 'r', 0};
|
||||
@ -455,6 +475,13 @@ START_TEST(job)
|
||||
|
||||
CoInitialize(NULL);
|
||||
|
||||
if (FAILED(test_create_manager()))
|
||||
{
|
||||
CoUninitialize();
|
||||
win_skip("Failed to create Manager instance, skipping tests\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (test = tests, i = 0; *test; ++test, ++i)
|
||||
{
|
||||
/* Keep state separate between tests. */
|
||||
|
@ -28,31 +28,24 @@
|
||||
|
||||
static WCHAR progname[MAX_PATH];
|
||||
|
||||
static void
|
||||
test_CreateInstance(void)
|
||||
static HRESULT test_create_manager(void)
|
||||
{
|
||||
HRESULT hres;
|
||||
ULONG res;
|
||||
IBackgroundCopyManager *manager = NULL;
|
||||
|
||||
/* Creating BITS instance */
|
||||
hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL, CLSCTX_LOCAL_SERVER,
|
||||
&IID_IBackgroundCopyManager, (void **) &manager);
|
||||
|
||||
if(hres == __HRESULT_FROM_WIN32(ERROR_SERVICE_DISABLED)) {
|
||||
skip("Needed Service is disabled\n");
|
||||
return;
|
||||
}
|
||||
ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
|
||||
if(hres != S_OK) {
|
||||
skip("Unable to create bits instance.\n");
|
||||
return;
|
||||
if(hres == HRESULT_FROM_WIN32(ERROR_SERVICE_DISABLED)) {
|
||||
win_skip("Needed Service is disabled\n");
|
||||
return hres;
|
||||
}
|
||||
|
||||
/* Releasing bits manager */
|
||||
res = IBackgroundCopyManager_Release(manager);
|
||||
ok(res == 0, "Bad ref count on release: %u\n", res);
|
||||
if (hres == S_OK)
|
||||
IBackgroundCopyManager_Release(manager);
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
static void test_CreateJob(void)
|
||||
@ -69,25 +62,16 @@ static void test_CreateJob(void)
|
||||
hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL,
|
||||
CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager,
|
||||
(void **) &manager);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to create bits instance required for test.\n");
|
||||
return;
|
||||
}
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
|
||||
/* Create bits job */
|
||||
hres = IBackgroundCopyManager_CreateJob(manager, copyNameW,
|
||||
BG_JOB_TYPE_DOWNLOAD, &tmpId,
|
||||
&job);
|
||||
ok(hres == S_OK, "CreateJob failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
skip("Unable to create bits job.\n");
|
||||
else
|
||||
{
|
||||
res = IBackgroundCopyJob_Release(job);
|
||||
ok(res == 0, "Bad ref count on release: %u\n", res);
|
||||
}
|
||||
|
||||
res = IBackgroundCopyJob_Release(job);
|
||||
ok(res == 0, "Bad ref count on release: %u\n", res);
|
||||
IBackgroundCopyManager_Release(manager);
|
||||
}
|
||||
|
||||
@ -101,36 +85,21 @@ static void test_EnumJobs(void)
|
||||
IBackgroundCopyJob *job = NULL;
|
||||
HRESULT hres;
|
||||
GUID tmpId;
|
||||
ULONG res;
|
||||
|
||||
/* Setup */
|
||||
hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL,
|
||||
CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager,
|
||||
(void **) &manager);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to create bits instance required for test.\n");
|
||||
return;
|
||||
}
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
|
||||
hres = IBackgroundCopyManager_CreateJob(manager, copyNameW,
|
||||
BG_JOB_TYPE_DOWNLOAD, &tmpId,
|
||||
&job);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to create bits job.\n");
|
||||
IBackgroundCopyManager_Release(manager);
|
||||
return;
|
||||
}
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
|
||||
hres = IBackgroundCopyManager_EnumJobs(manager, 0, &enumJobs);
|
||||
ok(hres == S_OK, "EnumJobs failed: %08x\n", hres);
|
||||
if(hres != S_OK)
|
||||
skip("Unable to create job enumerator.\n");
|
||||
else
|
||||
{
|
||||
res = IEnumBackgroundCopyJobs_Release(enumJobs);
|
||||
ok(res == 0, "Bad ref count on release: %u\n", res);
|
||||
}
|
||||
IEnumBackgroundCopyJobs_Release(enumJobs);
|
||||
|
||||
/* Tear down */
|
||||
IBackgroundCopyJob_Release(job);
|
||||
@ -164,11 +133,7 @@ static void do_child(const char *secretA)
|
||||
hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL,
|
||||
CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager,
|
||||
(void **) &manager);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to create bits instance required for test.\n");
|
||||
return;
|
||||
}
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, secretA, -1, secretW, MAX_PATH);
|
||||
hres = IBackgroundCopyManager_CreateJob(manager, secretW,
|
||||
@ -188,11 +153,7 @@ static void test_globalness(void)
|
||||
hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL,
|
||||
CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager,
|
||||
(void **) &manager);
|
||||
if(hres != S_OK)
|
||||
{
|
||||
skip("Unable to create bits instance required for test.\n");
|
||||
return;
|
||||
}
|
||||
ok(hres == S_OK, "got 0x%08x\n", hres);
|
||||
|
||||
wsprintfW(secretName, format, GetTickCount());
|
||||
run_child(secretName);
|
||||
@ -219,8 +180,8 @@ static void test_globalness(void)
|
||||
CoTaskMemFree(name);
|
||||
IBackgroundCopyJob_Release(job);
|
||||
}
|
||||
hres = IEnumBackgroundCopyJobs_Release(enumJobs);
|
||||
ok(hres == S_OK, "Release failed: %08x\n", hres);
|
||||
|
||||
IEnumBackgroundCopyJobs_Release(enumJobs);
|
||||
ok(found, "Adding a job in another process failed\n");
|
||||
}
|
||||
|
||||
@ -234,11 +195,18 @@ START_TEST(qmgr)
|
||||
MultiByteToWideChar(CP_ACP, 0, argv[0], -1, progname, MAX_PATH);
|
||||
|
||||
CoInitialize(NULL);
|
||||
|
||||
if (FAILED(test_create_manager()))
|
||||
{
|
||||
win_skip("Failed to create Manager instance, skipping tests\n");
|
||||
CoUninitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
if (argc == 3)
|
||||
do_child(argv[2]);
|
||||
else
|
||||
{
|
||||
test_CreateInstance();
|
||||
test_CreateJob();
|
||||
test_EnumJobs();
|
||||
test_globalness();
|
||||
|
Loading…
Reference in New Issue
Block a user