-
Notifications
You must be signed in to change notification settings - Fork 0
/
dctest.cpp
771 lines (629 loc) · 18.7 KB
/
dctest.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
//
// Copyright (c) 2003 Timothy A. Seufert (tas@mindspring.com)
// Copyright (c) 2016 Jason Bishop (jason.bishop@gmail.com)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. The name of the author may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// v 2.2 - added interleaved complement writes to detect lost writes
//
// dctest 2.2 -- Disk Corruption Tester
//
// $Id: dctest.cpp,v 1.19 2004/09/06 23:16:07 tas Exp $
//
// This program tests for data corruption during disk I/O. Since it is
// an end to end test (goes through the file system) it often manages to
// find other kinds of hardware problems too (such as bad RAM).
//
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <pthread.h>
#include <signal.h>
#include <stdint.h>
#include "workqueue.h"
#include "PRBS23.h"
const char* copyright_banner =
"Disk Corruption Tester (dctest) version 2.2\n"
"Copyright (C) 2003 Timothy A. Seufert (tas@mindspring.com)\n"
"Copyright (C) 2016 Jason Bishop (jason.bishop@gmail.com)\n";
typedef enum { CREATE, VERIFY } testmode;
typedef enum { REGULAR, COMPLEMENT } bitmode;
//
// How large a work buffer is, in megabytes. This value is approximate because
// the actual buffer size may be affected by the system's page size.
//
const uint32_t bufsize_Mbytes = 4;
//
// The number of uint32_ts in a work buffer. This value is calculated by main().
//
uint32_t bufsize = 0;
//
// Global settings.
//
const char* testfilename = "test.dat";
const char* logfilename = "dctest.log";
uint32_t testcount = 1;
uint32_t verifypasses = 1;
uint32_t filesize_MB = 100;
bool halt_on_error = false;
bool display_help = false;
uint32_t pagesize = 0;
//
// Settings derived from primary global settings above.
//
FILE* logfile = NULL;
off_t filesize = 0;
//
// Table of command line parameters
//
struct ptable_entry {
const char* name;
const char* alt_name;
const char* description;
uint32_t* uint_param;
bool* bool_param;
const char** string_param;
bool interactive_entry_allowed;
};
ptable_entry ptable[] = {
{ "--name", "-n", "Name of test file (default test.dat)",
NULL, NULL, &testfilename, true },
{ "--log", "-l", "Name of log file (default log.txt)",
NULL, NULL, &logfilename, true },
{ "--count", "-c", "Number of times to run test, 0 = infinite loop (default 1)",
&testcount, NULL, NULL, true },
{ "--verify", "-v", "Number of verification passes per test (default 1)",
&verifypasses, NULL, NULL, true },
{ "--size", "-s", "Size of test file, in megabytes (default 100)",
&filesize_MB, NULL, NULL, true },
{ "--halt", NULL, "Halt if corruption is detected, leaving test file intact",
NULL, &halt_on_error, NULL, true },
{ "--help", "-h", "Display help",
NULL, &display_help, NULL, false },
{ NULL, NULL, NULL, NULL, NULL, NULL, false }
};
//
// Replacement for strdup, since strdup is not present on all systems
//
char* dupstr(char* s)
{
int len = strlen(s) + 1;
char* copy = (char*) malloc(len);
if (copy != NULL) memcpy(copy, s, len);
return copy;
}
//
// Account for lack of getpagesize() call under "classic" MacOS
//
#ifdef MPW
int getpagesize(void)
{
return 4096;
}
#endif
//
// Some silliness necessary to compensate for a certain compiler that believes
// functions in a C++ source file have a different type signature than ordinary
// C functions, and therefore barfs when you try to use said functions as
// parameters to APIs that were defined in C source files...
//
extern "C" {
typedef void* (*pthread_fn_ptr)(void *);
typedef void (*sig_fn_ptr)(int);
};
//
// Fatal error handler.
//
void fatal(const char *fmt, ...)
{
va_list arglist;
va_start(arglist, fmt);
vfprintf(stderr, fmt, arglist);
//
// Flush stdout and logfile so that nothing gets lost.
//
fflush(stdout);
if (logfile != NULL) {
fflush(logfile);
}
exit(-1);
}
//
// Prints the same message to the console and to the logfile.
//
void print_and_log(const char* fmt, ...)
{
static char pbuf[512];
va_list arglist;
va_start(arglist, fmt);
vsnprintf(pbuf, 512, fmt, arglist);
fputs(pbuf, stdout);
fputs(pbuf, logfile);
}
//
// Signal handler function (clean up before exiting)
//
void sigcleanup(int sig)
{
//
// Flush stdout and logfile so that nothing gets lost.
//
fflush(stdout);
if (logfile != NULL) {
fflush(logfile);
}
//
// Reraise the signal so it kills us.
//
signal(sig, SIG_DFL);
raise(sig);
}
//
// Timestamp function for computing throughput
//
double timestamp()
{
struct timeval tv;
struct timezone tz;
gettimeofday(&tv, &tz);
return ( (double) tv.tv_sec + (double) tv.tv_usec * 1e-6 );
}
//
// Utility functions for displaying progress indicators
//
off_t progress_amount_displayed;
off_t progress_delta;
char progress_mark;
void init_progress_display(off_t worklen)
{
progress_amount_displayed = 0;
progress_delta = worklen / 64;
progress_mark = '.';
}
void display_progress(off_t progress)
{
if (progress >= (progress_amount_displayed + progress_delta)) {
while (progress >= (progress_amount_displayed + progress_delta)) {
progress_amount_displayed += progress_delta;
putchar(progress_mark);
}
fflush(stdout);
}
progress_mark = '.';
}
void print_rate(off_t len, double elapsed_time)
{
// get the size into megabytes, then print the rate
double megabytes = len * sizeof(uint32_t) / 1048576.0;
printf(" (%.1f MB/s)\n", megabytes / elapsed_time);
}
//
// Fill a buffer with PRBS23 data.
//
void fillbuf(uint32_t* buf, uint32_t buflen, uint32_t& shiftreg, bitmode bmode)
{
register uint32_t s = shiftreg;
if (bmode == COMPLEMENT) {
s = ~s;
}
for (uint32_t i = 0; i < buflen; i++) {
buf[i] = s;
if (bmode == REGULAR) {
s = PRBS23_Next_Value(s);
} else {
s = ~PRBS23_Next_Value(s);
}
}
shiftreg = s;
}
//
// Check that a buffer contains PRBS23 data.
//
void checkbuf(uint32_t* buf, uint32_t buflen, uint32_t& shiftreg, long int& found_corruption, off_t offset, bitmode bmode)
{
register uint32_t s = shiftreg;
if (bmode == COMPLEMENT) {
s = ~s;
}
for (uint32_t i = 0; i < buflen; i++) {
if (buf[i] != s) {
fprintf(logfile, "\tERROR: At file offset %016lX, expected %08X, got %08X\n",
offset + ((off_t)i * sizeof(uint32_t)), s, buf[i]);
found_corruption = 1;
progress_mark = 'E';
}
if (bmode == REGULAR) {
s = PRBS23_Next_Value(s);
} else {
s = ~PRBS23_Next_Value(s);
}
}
shiftreg = s;
}
//
// Structure for communicating information to worker threads
//
struct workorder {
workqueue* q;
testmode mode;
int fd;
bitmode bmode;
off_t filesize;
};
//
// Subclass qelem to create a work buffer class.
//
class wbuf : public qelem {
public:
wbuf() {
//
// buf should be page aligned for best performance. So far, have not needed to
// explicitly align it since many malloc implementations return page aligned
// buffers when the requested block of memory is larger than a page. Should
// use posix_memalign instead of malloc on systems which support it.
//
int ret = posix_memalign((void**)&buf, getpagesize(), bufsize * sizeof(uint32_t));
if (0 != ret) {
printf("posix_memalign returned error\n");
}
}
virtual ~wbuf() {
free(buf);
}
uint32_t buflen;
uint32_t* buf;
};
//
// Producer thread for testfile creation and verification.
//
void* producer_fn(void* param)
{
workorder* wo = (workorder*) param;
workqueue* q = wo->q;
uint32_t shiftreg = PRBS23_INITIAL_VALUE;
off_t remaining_work = wo->filesize;
wbuf* workbuf;
printf("producer %s\n", (wo->bmode == REGULAR) ? "regular" : "complement");
while (remaining_work > 0) {
workbuf = (wbuf*) q->get();
workbuf->buflen = (remaining_work > bufsize) ? (bufsize) : (remaining_work);
if (wo->mode == VERIFY) {
// need to add logic to check # bytes read
uint readbytes = 0;
do {
readbytes += read(wo->fd, workbuf->buf+readbytes, workbuf->buflen * sizeof(uint32_t) - readbytes);
} while (readbytes < workbuf->buflen * sizeof(uint32_t));
} else {
fillbuf(workbuf->buf, workbuf->buflen, shiftreg, wo->bmode);
}
remaining_work -= workbuf->buflen;
q->enqueue(workbuf);
}
// Tell consumer to shut down by sending it a workbuf with no work.
workbuf = (wbuf*) q->get();
workbuf->buflen = 0;
q->enqueue(workbuf);
// Tell consumer to shut down by sending it a workbuf with no work.
workbuf = (wbuf*) q->get();
workbuf->buflen = 0;
q->enqueue(workbuf);
return ((void*) 0);
}
//
// Consumer thread for testfile creation and verification.
//
void* consumer_fn(void* param)
{
workorder* wo = (workorder*) param;
workqueue* q = wo->q;
uint32_t shiftreg = PRBS23_INITIAL_VALUE;
off_t progress = 0;
long int found_corruption = 0;
init_progress_display(wo->filesize * sizeof(uint32_t));
while (1) {
wbuf* workbuf = (wbuf*) q->dequeue();
if (workbuf->buflen == 0) {
q->release(workbuf);
break;
}
if (wo->mode == VERIFY) {
checkbuf(workbuf->buf, workbuf->buflen, shiftreg, found_corruption, progress, wo->bmode);
} else {
uint writtenbytes = 0;
do {
writtenbytes += write(wo->fd, workbuf->buf+writtenbytes, workbuf->buflen * sizeof(uint32_t) - writtenbytes);
} while (writtenbytes < workbuf->buflen * sizeof(uint32_t));
}
progress += (workbuf->buflen * sizeof(uint32_t));
q->release(workbuf);
display_progress(progress);
}
return ((void*) found_corruption);
}
//
// process_testfile()
//
// Creates (mode == CREATE) or verifies (mode == VERIFY) a testfile named filename,
// filesize uint32_ts long. Uses worker threads to accomplish the actual work,
// overlapping I/O with computation.
//
// If used in VERIFY mode, returns 1 if any corruption was encountered during
// the test. Otherwise, returns 0.
//
// File size parameter is in units of uint32_t, not char.
//
int process_testfile(testmode mode, const char* filename, off_t filesize, int count)
{
int found_corruption = 0;
pthread_t producer, consumer;
pthread_attr_t attr;
int fd;
if (mode == VERIFY) {
fd = open(filename, O_RDONLY|O_LARGEFILE|O_DIRECT, 0);
} else {
fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE|O_DIRECT, 0644);
}
if (fd == -1) {
fatal("Error: Couldn't open test file (%s).\n", filename);
}
// On MacOS X, turn off caching. Ideally this should be done on any OS that
// supports it, since cache can defeat end-to-end testing.
#if defined(__APPLE__) && defined(__MACH__)
fcntl(fd, F_NOCACHE, 1);
#endif
wbuf* buffers = new wbuf[2];
workqueue* q = new workqueue;
workorder* wo = new workorder;
wo->q = q;
wo->mode = mode;
wo->fd = fd;
wo->filesize = filesize;
wo->bmode = (count % 2 == 0) ? COMPLEMENT : REGULAR;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
int p_err = pthread_create(&producer, &attr, (pthread_fn_ptr) producer_fn, (void*) wo);
int c_err = pthread_create(&consumer, &attr, (pthread_fn_ptr) consumer_fn, (void*) wo);
if (p_err || c_err) {
fatal("Error while creating worker threads.\n");
}
double start_time = timestamp();
// Give the work queue some empty buffers to get things moving
q->release(&(buffers[0]));
q->release(&(buffers[1]));
// Now wait for the threads to finish
p_err = pthread_join(producer, (void**)(&found_corruption));
c_err = pthread_join(consumer, (void**)(&found_corruption));
double end_time = timestamp();
if (p_err || c_err) {
fatal("pthread_join() error.\n");
}
print_rate(filesize, end_time - start_time);
pthread_attr_destroy(&attr);
delete wo;
delete q;
delete [] buffers;
close(fd);
return found_corruption;
}
void print_usage(void)
{
printf("\n%s\n"
"Usage: dctest option1 <parm1> option2 <parm2> ...\n"
"\n"
"Options:\n",
copyright_banner);
for (int p = 0; ptable[p].name != NULL; p++) {
printf(" %s", ptable[p].name);
if (ptable[p].uint_param != NULL) {
printf(" N");
} else if (ptable[p].string_param != NULL) {
printf(" filename");
}
if (ptable[p].alt_name != NULL) {
printf(" / %s", ptable[p].alt_name);
if (ptable[p].uint_param != NULL) {
printf(" N");
} else if (ptable[p].string_param != NULL) {
printf(" filename");
}
}
printf("\n %s\n\n", ptable[p].description);
}
printf("Example: Run test 5 times, logging to a file named \"foo.txt\":\n"
" dctest --c 5 --log foo.txt\n\n");
}
int process_argument(char* arg, char* nextarg)
{
int arguments_processed = 1;
for (int p = 0; ; p++) {
if (ptable[p].name == NULL) {
print_usage();
fatal("Error: Unknown parameter %s\n\n", arg);
}
bool match = (strcmp(arg, ptable[p].name) == 0);
if (ptable[p].alt_name != NULL) {
match |= (strcmp(arg, ptable[p].alt_name)==0);
}
if (match) {
if (ptable[p].bool_param != NULL) {
*(ptable[p].bool_param) = true;
} else {
if (nextarg == NULL) {
print_usage();
fatal("Error: Missing parameter for argument %s .\n\n", arg);
}
if (ptable[p].uint_param != NULL) {
sscanf(nextarg, "%u", ptable[p].uint_param);
} else if (ptable[p].string_param != NULL) {
*(ptable[p].string_param) = dupstr(nextarg);
}
arguments_processed = 2;
}
break;
}
}
return arguments_processed;
}
void read_arguments(void)
{
char param[512];
char* token;
printf("\nEnter test parameters (hit return to accept default shown in parentheses)\n");
for (int p = 0; ptable[p].name != NULL; p++) {
if (ptable[p].interactive_entry_allowed == true) {
printf("%s%s: ", ptable[p].description,
(ptable[p].bool_param != NULL) ? (" [y/n] (n)") : (""));
char* ret = fgets(param, 512, stdin);
if (NULL == ret) {
printf("fgets returned error\n");
}
token = strtok(param, " \f\n\r\t\v");
if (token != NULL) {
if (ptable[p].uint_param != NULL) {
sscanf(token, "%u", ptable[p].uint_param);
} else if (ptable[p].string_param != NULL) {
*(ptable[p].string_param) = dupstr(token);
} else if (ptable[p].bool_param != NULL) {
*(ptable[p].bool_param) = (token[0] == 'y' || token[0] == 'Y');
}
}
}
}
}
int main(int argc, char* argv[])
{
int return_val = 0, err;
//
// Install signal handler to perform cleanup before exit.
//
signal(SIGINT, (sig_fn_ptr) sigcleanup);
signal(SIGHUP, (sig_fn_ptr) sigcleanup);
signal(SIGTERM, (sig_fn_ptr) sigcleanup);
if (argc < 2) {
printf("\n%s\nNo parameters supplied. Entering interactive mode.\n"
"For help on command line params, use --help switch.\n"
"Hit Control-C at any time to exit program.\n", copyright_banner);
read_arguments();
} else {
for (int i = 1; i < argc; ) {
i += process_argument(argv[i], argv[i+1]);
}
}
if (display_help) {
print_usage();
return 0;
}
if (testcount < 0 || testcount > 10000) {
fatal("\nError: Test count value %d is out of range (0 - 10000)\n\n", testcount);
}
if (verifypasses < 1 || verifypasses > 100) {
fatal("\nError: Verification passes value %d is out of range (1 - 100)\n\n", verifypasses);
}
if (filesize_MB < 1 || filesize_MB > 16777216) {
fatal("\nError: Test file size %d is out of range (1 - 16777216)\n\n", filesize_MB);
}
//
// In many operating systems it is advantageous to do file I/O in units of pages,
// using buffers which start on page boundaries. Therefore we shall make the buffer
// size a multiple of the page size and a multiple of the unit of work (uint32_t),
// while trying to keep it at least as large as the bufsize_Mbytes constant.
//
pagesize = getpagesize();
uint32_t base_size = pagesize * sizeof(uint32_t);
bufsize = ((0x100000 * bufsize_Mbytes) / base_size) + 1;
bufsize = bufsize * base_size;
//
// For the purposes of the rest of the program, the buffer size is the number of uint32_ts
// in a buffer, not the number of bytes.
//
bufsize /= sizeof(uint32_t);
//
// Translate the file size from megabytes to uint32_ts.
//
filesize = (off_t) filesize_MB * (1048576 / sizeof(uint32_t));
//
// Create the log file.
//
logfile = fopen(logfilename, "a");
if (logfile == NULL) {
fatal("Error: Couldn't open log file (%s).\n", logfilename);
}
time_t t = time(NULL);
fprintf(logfile,
"\n============================================================\n"
"%s\n"
"Start time: %s\n",
copyright_banner,
ctime(&t));
fprintf(logfile,
"Test parameters:\n\t"
"Test file size is %d megabytes\n\t",
filesize_MB);
fprintf(logfile,
"%d%s test iteration%s\n\t",
testcount,
(testcount == 0) ? (" (infinite loop)") : (""),
(testcount == 1) ? ("") : ("s") );
fprintf(logfile,
"%d verification pass%s per test iteration\n",
verifypasses,
(verifypasses == 1) ? ("") : ("es") );
//
// Test loop.
//
for (uint32_t testnum = 1; (testnum <= testcount) || (testcount == 0); testnum++) {
print_and_log("\nBeginning test iteration #%d; creating test file...", testnum);
putchar('\n');
process_testfile(CREATE, testfilename, filesize, testnum);
fprintf(logfile, " (done)\n");
for (uint32_t pass = 1; pass <= verifypasses; pass++) {
printf("Verifying integrity of test file, pass #%d\n", pass);
err = process_testfile(VERIFY, testfilename, filesize, testnum);
fprintf(logfile, "Completed test #%d verification pass #%d (%s)\n",
testnum, pass, (err) ? "FAIL" : "OK");
if (err) {
printf("Warning, corruption detected! Check logfile for details.\n");
return_val = 1;
if (halt_on_error) {
print_and_log("\nHalting test.\n");
fclose(logfile);
logfile = NULL;
return 1;
}
}
}
}
print_and_log("\nFinished testing.\n\n");
// if (remove(testfilename)) {
// print_and_log("Warning: test file could not be deleted!\n\n");
// }
fclose(logfile);
return return_val;
}