1.1 --- a/tests/dstest_file_client.cc Thu Sep 01 21:40:39 2022 +0200
1.2 +++ b/tests/dstest_file_client.cc Thu Sep 01 21:52:41 2022 +0200
1.3 @@ -111,26 +111,21 @@
1.4 if (!(*(buffer + nread - 1)))
1.5 printf("Warning: length before zero region is %ld\n", strlen(buffer));
1.6
1.7 -#if 0
1.8 - for (offset_t i = 0; i < nread; i += 60)
1.9 - {
1.10 - fwrite(buffer + i, sizeof(char), nread - i > 60 ? 60 : nread - i, stdout);
1.11 - fputs("\n", stdout);
1.12 - }
1.13 -#endif
1.14 nread = client_read(file, buffer, size);
1.15 }
1.16
1.17 /* Without any more content, a peer closed event should terminate reading
1.18 - from the pipe. */
1.19 + from the file. */
1.20
1.21 if (file->notifications & NOTIFY_PEER_CLOSED)
1.22 break;
1.23
1.24 + /* Otherwise, write some data to the file for the other party. */
1.25 +
1.26 write_data(file, region++);
1.27 }
1.28
1.29 - printf("Data shown.\n");
1.30 + printf("Data written: %s\n", region == 26 ? "True" : "False");
1.31 }
1.32
1.33 int main(int argc, char *argv[])
1.34 @@ -147,8 +142,10 @@
1.35 file1 = client_open(filename, O_RDWR | O_CREAT);
1.36 file2 = client_open(filename, O_RDWR);
1.37
1.38 - if ((file1 == NULL) || (file2 == NULL))
1.39 + if (!client_opened(file1) || !client_opened(file2))
1.40 {
1.41 + client_close(file1);
1.42 + client_close(file2);
1.43 printf("Could not obtain files.\n");
1.44 return 1;
1.45 }
1.46 @@ -162,6 +159,8 @@
1.47
1.48 for (int i = 0; i < 2; i++)
1.49 activities[i]->join();
1.50 +
1.51 + printf("End of test.\n");
1.52 }
1.53
1.54 // vim: tabstop=2 expandtab shiftwidth=2