1.1 --- a/tests/dstest_file_monitor.cc Wed Mar 29 00:32:20 2023 +0200
1.2 +++ b/tests/dstest_file_monitor.cc Mon Apr 03 00:35:34 2023 +0200
1.3 @@ -56,6 +56,7 @@
1.4 {
1.5 sprintf(buffer, "%s/file%02d", filename, i);
1.6
1.7 + printf("Open file %d.\n", i);
1.8 client_open(buffer, O_CREAT | O_RDWR);
1.9 sleep(1);
1.10 }
1.11 @@ -65,21 +66,13 @@
1.12
1.13 static void monitor_files(file_t *directory)
1.14 {
1.15 - long err = client_subscribe(directory, NOTIFY_FILE_OPENED, client_notifier_task());
1.16 -
1.17 - if (err)
1.18 - {
1.19 - printf("Could not subscribe to events on directory.\n");
1.20 - return;
1.21 - }
1.22 -
1.23 int expected;
1.24
1.25 for (expected = FILES_TO_OPEN; expected; expected--)
1.26 {
1.27 /* Wait for notification of content. */
1.28
1.29 - err = client_wait_file(directory, client_notifier_task());
1.30 + long err = client_wait_file(directory, client_notifier_task());
1.31
1.32 if (err)
1.33 {
1.34 @@ -116,6 +109,14 @@
1.35 return 1;
1.36 }
1.37
1.38 + long err = client_subscribe(directory, NOTIFY_FILE_OPENED, client_notifier_task());
1.39 +
1.40 + if (err)
1.41 + {
1.42 + printf("Could not subscribe to events on directory.\n");
1.43 + return 1;
1.44 + }
1.45 +
1.46 /* Schedule threads. */
1.47
1.48 std::thread *activities[2];
1.49 @@ -127,6 +128,9 @@
1.50 activities[i]->join();
1.51
1.52 printf("Expected %d 'file opened' notifications.\n", FILES_TO_OPEN);
1.53 +
1.54 + client_close(directory);
1.55 +
1.56 printf("End of test.\n");
1.57 return 0;
1.58 }