Alexandre Julliard a écrit :
Eric Pouech eric.pouech@wanadoo.fr writes:
+static int get_file_name(char* buf, size_t len, const char* hint) +{
- char* ptr;
- if (strcmp(winetest_platform, "windows"))
- {
sprintf(buf, "%s/%s", base, hint);
for (ptr = buf; *ptr; ptr++)
if (*ptr == '\\') *ptr = '/';
- }
- else
- {
sprintf(buf, "%s\\%s", base, hint);
for (ptr = buf; *ptr; ptr++)
if (*ptr == '/') *ptr = '\\';
- }
- //fprintf(stderr, "resfile=%s\n", buf);
- return 0;
+}
You should never do that kind of things. The platform must be used exclusively for todo tests, not for changing the test behavior. And backslashes should work fine under Wine too.
the point here is not really part of the test. I needed a way to send back information from the child to the parent. To minimize the scope of the test, I didn't want to use too many Windows functions here, and decided to use libc file IO for that. The encoding here is just to use the same absolute filename (absolute because tests may change the current directory, so relative paths are no good, name with libc semantics)
of course, I could use regular windows file name (or even another way of sharing information (registry, anon map, pipe...)), but I wanted the test to be as independent as possible on other APIs
so, my final questions: what is your direction here: to test a specific API, should we limit the scaffholding (provide by other APIs), or should we just use them as freely as needed
My point here is that the more APIs we use, the more regressions we'll have in the tests after one evilish modification, hence complicating its search.
A+