dbghelp/tests: Add tests for SymSetSearchPath.
Signed-off-by: Thomas Faber <thomas.faber@reactos.org> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
06f1c40f17
commit
6bedd7cce6
|
@ -132,12 +132,83 @@ static void test_stack_walk(void)
|
||||||
|
|
||||||
#endif /* __i386__ || __x86_64__ */
|
#endif /* __i386__ || __x86_64__ */
|
||||||
|
|
||||||
|
static void test_search_path(void)
|
||||||
|
{
|
||||||
|
char search_path[128];
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
|
/* The default symbol path is ".[;%_NT_SYMBOL_PATH%][;%_NT_ALT_SYMBOL_PATH%]".
|
||||||
|
* We unset both variables earlier so should simply get "." */
|
||||||
|
ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
todo_wine
|
||||||
|
ok(!strcmp(search_path, "."), "Got search path '%s', expected '.'\n", search_path);
|
||||||
|
|
||||||
|
/* Set an arbitrary search path */
|
||||||
|
ret = SymSetSearchPath(GetCurrentProcess(), "W:\\");
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ok(!strcmp(search_path, "W:\\"), "Got search path '%s', expected 'W:\\'\n", search_path);
|
||||||
|
|
||||||
|
/* Setting to NULL resets to the default */
|
||||||
|
ret = SymSetSearchPath(GetCurrentProcess(), NULL);
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
todo_wine
|
||||||
|
ok(!strcmp(search_path, "."), "Got search path '%s', expected '.'\n", search_path);
|
||||||
|
|
||||||
|
/* With _NT_SYMBOL_PATH */
|
||||||
|
SetEnvironmentVariableA("_NT_SYMBOL_PATH", "X:\\");
|
||||||
|
ret = SymSetSearchPath(GetCurrentProcess(), NULL);
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
todo_wine
|
||||||
|
ok(!strcmp(search_path, ".;X:\\"), "Got search path '%s', expected '.;X:\\'\n", search_path);
|
||||||
|
|
||||||
|
/* With both _NT_SYMBOL_PATH and _NT_ALT_SYMBOL_PATH */
|
||||||
|
SetEnvironmentVariableA("_NT_ALT_SYMBOL_PATH", "Y:\\");
|
||||||
|
ret = SymSetSearchPath(GetCurrentProcess(), NULL);
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
todo_wine
|
||||||
|
ok(!strcmp(search_path, ".;X:\\;Y:\\"), "Got search path '%s', expected '.;X:\\;Y:\\'\n", search_path);
|
||||||
|
|
||||||
|
/* With just _NT_ALT_SYMBOL_PATH */
|
||||||
|
SetEnvironmentVariableA("_NT_SYMBOL_PATH", NULL);
|
||||||
|
ret = SymSetSearchPath(GetCurrentProcess(), NULL);
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
todo_wine
|
||||||
|
ok(!strcmp(search_path, ".;Y:\\"), "Got search path '%s', expected '.;Y:\\'\n", search_path);
|
||||||
|
|
||||||
|
/* Restore original search path */
|
||||||
|
SetEnvironmentVariableA("_NT_ALT_SYMBOL_PATH", NULL);
|
||||||
|
ret = SymSetSearchPath(GetCurrentProcess(), NULL);
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ret = SymGetSearchPath(GetCurrentProcess(), search_path, ARRAY_SIZE(search_path));
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
todo_wine
|
||||||
|
ok(!strcmp(search_path, "."), "Got search path '%s', expected '.'\n", search_path);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(dbghelp)
|
START_TEST(dbghelp)
|
||||||
{
|
{
|
||||||
BOOL ret = SymInitialize(GetCurrentProcess(), NULL, TRUE);
|
BOOL ret;
|
||||||
|
|
||||||
|
/* Don't let the user's environment influence our symbol path */
|
||||||
|
SetEnvironmentVariableA("_NT_SYMBOL_PATH", NULL);
|
||||||
|
SetEnvironmentVariableA("_NT_ALT_SYMBOL_PATH", NULL);
|
||||||
|
|
||||||
|
ret = SymInitialize(GetCurrentProcess(), NULL, TRUE);
|
||||||
ok(ret, "got error %u\n", GetLastError());
|
ok(ret, "got error %u\n", GetLastError());
|
||||||
|
|
||||||
test_stack_walk();
|
test_stack_walk();
|
||||||
|
test_search_path();
|
||||||
|
|
||||||
ret = SymCleanup(GetCurrentProcess());
|
ret = SymCleanup(GetCurrentProcess());
|
||||||
ok(ret, "got error %u\n", GetLastError());
|
ok(ret, "got error %u\n", GetLastError());
|
||||||
|
|
Loading…
Reference in New Issue