Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
ded68372
Commit
ded68372
authored
Mar 20, 2008
by
Michael Moss
Committed by
Alexandre Julliard
Mar 20, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Test notifications for overlapping directory watches.
parent
6ee428e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
0 deletions
+87
-0
change.c
dlls/kernel32/tests/change.c
+87
-0
No files found.
dlls/kernel32/tests/change.c
View file @
ded68372
...
...
@@ -776,6 +776,92 @@ static void test_readdirectorychanges_filedir(void)
ok
(
r
==
TRUE
,
"failed to remove directory
\n
"
);
}
static
void
test_ffcn_directory_overlap
(
void
)
{
HANDLE
parent_watch
,
child_watch
,
parent_thread
,
child_thread
;
char
workdir
[
MAX_PATH
],
parentdir
[
MAX_PATH
],
childdir
[
MAX_PATH
];
char
tempfile
[
MAX_PATH
];
DWORD
threadId
;
BOOL
ret
;
/* Setup directory hierarchy */
ret
=
GetTempPathA
(
MAX_PATH
,
workdir
);
ok
((
ret
>
0
)
&&
(
ret
<=
MAX_PATH
),
"GetTempPathA error: %d
\n
"
,
GetLastError
());
ret
=
GetTempFileNameA
(
workdir
,
"fcn"
,
0
,
tempfile
);
ok
(
ret
,
"GetTempFileNameA error: %d
\n
"
,
GetLastError
());
ret
=
DeleteFileA
(
tempfile
);
ok
(
ret
,
"DeleteFileA error: %d
\n
"
,
GetLastError
());
lstrcpyA
(
parentdir
,
tempfile
);
ret
=
CreateDirectoryA
(
parentdir
,
NULL
);
ok
(
ret
,
"CreateDirectoryA error: %d
\n
"
,
GetLastError
());
lstrcpyA
(
childdir
,
parentdir
);
lstrcatA
(
childdir
,
"
\\
c"
);
ret
=
CreateDirectoryA
(
childdir
,
NULL
);
ok
(
ret
,
"CreateDirectoryA error: %d
\n
"
,
GetLastError
());
/* When recursively watching overlapping directories, changes in child
* should trigger notifications for both child and parent */
parent_thread
=
StartNotificationThread
(
parentdir
,
TRUE
,
FILE_NOTIFY_CHANGE_FILE_NAME
);
child_thread
=
StartNotificationThread
(
childdir
,
TRUE
,
FILE_NOTIFY_CHANGE_FILE_NAME
);
/* Create a file in child */
ret
=
GetTempFileNameA
(
childdir
,
"fcn"
,
0
,
tempfile
);
ok
(
ret
,
"GetTempFileNameA error: %d
\n
"
,
GetLastError
());
/* Both watches should trigger */
ret
=
FinishNotificationThread
(
parent_thread
);
ok
(
ret
,
"Missed parent notification
\n
"
);
ret
=
FinishNotificationThread
(
child_thread
);
ok
(
ret
,
"Missed child notification
\n
"
);
ret
=
DeleteFileA
(
tempfile
);
ok
(
ret
,
"DeleteFileA error: %d
\n
"
,
GetLastError
());
/* Removing a recursive parent watch should not affect child watches. Doing
* so used to crash wineserver. */
parent_watch
=
FindFirstChangeNotificationA
(
parentdir
,
TRUE
,
FILE_NOTIFY_CHANGE_FILE_NAME
);
ok
(
parent_watch
!=
INVALID_HANDLE_VALUE
,
"FindFirstChangeNotification error: %d
\n
"
,
GetLastError
());
child_watch
=
FindFirstChangeNotificationA
(
childdir
,
TRUE
,
FILE_NOTIFY_CHANGE_FILE_NAME
);
ok
(
child_watch
!=
INVALID_HANDLE_VALUE
,
"FindFirstChangeNotification error: %d
\n
"
,
GetLastError
());
ret
=
FindCloseChangeNotification
(
parent_watch
);
ok
(
ret
,
"FindCloseChangeNotification error: %d
\n
"
,
GetLastError
());
child_thread
=
CreateThread
(
NULL
,
0
,
NotificationThread
,
(
LPVOID
)
child_watch
,
0
,
&
threadId
);
ok
(
child_thread
!=
NULL
,
"CreateThread error: %d
\n
"
,
GetLastError
());
/* Create a file in child */
ret
=
GetTempFileNameA
(
childdir
,
"fcn"
,
0
,
tempfile
);
ok
(
ret
,
"GetTempFileNameA error: %d
\n
"
,
GetLastError
());
/* Child watch should trigger */
ret
=
FinishNotificationThread
(
child_thread
);
ok
(
ret
,
"Missed child notification
\n
"
);
/* clean up */
ret
=
DeleteFileA
(
tempfile
);
ok
(
ret
,
"DeleteFileA error: %d
\n
"
,
GetLastError
());
ret
=
RemoveDirectoryA
(
childdir
);
ok
(
ret
,
"RemoveDirectoryA error: %d
\n
"
,
GetLastError
());
ret
=
RemoveDirectoryA
(
parentdir
);
ok
(
ret
,
"RemoveDirectoryA error: %d
\n
"
,
GetLastError
());
}
START_TEST
(
change
)
{
HMODULE
hkernel32
=
GetModuleHandle
(
"kernel32"
);
...
...
@@ -791,4 +877,5 @@ START_TEST(change)
test_readdirectorychanges
();
test_readdirectorychanges_null
();
test_readdirectorychanges_filedir
();
test_ffcn_directory_overlap
();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment