diff -Nru stress-ng-0.03.19/debian/changelog stress-ng-0.03.20/debian/changelog --- stress-ng-0.03.19/debian/changelog 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/debian/changelog 2015-02-26 17:18:14.000000000 +0000 @@ -1,3 +1,30 @@ +stress-ng (0.03.20-1) unstable; urgency=medium + + * Makefile: bump version + * sched: Fix build warning on get_sched_name on GNU HURD + * stress-hdd: Fix incorrect format specifier %zu for a uint64_t + * stress-fallocate: Fix off_t printf warnings on 32 bit GNU HURD + * Fix resource leak (file descriptor) on error exit of stress-hdd + * Fix Manual, clarify the action of hdd stressor + * stress-aio: reduce scope of ret + * Fix missing stressor name in pr_err() messages + * Fix missing stressor name in pr_inf() and pr_dbg() messages + * Fix missing stressor name in pr_fail() messages + * stress-hdd: fix verify mode for hdd stressor + * stress-hdd: fix missing read if no read preference specified + * sched: fix default priority levels and lack of class name in messages + * stress-hdd: fix read of end of file when generated with random writes + * Fix extraneous leading space after the "hogs:" message + * stress-hdd: fix false error reports on short reads + * stress-hdd: fix noisy "incomplete reads" debug message + * stress-fallocate: fix incorrect errors reported on fallocate sizes + * stress-fallocate: fix error messages, they are rather meaningless + * stress-aio: report correct errno on async error + * stress-aio: handle EAGAIN and EINTR correctly + * stress-hdd: POSIX_FADV_RND should be POSIX_FADV_RANDOM + + -- Colin King Thu, 26 Feb 2015 17:17:00 +0000 + stress-ng (0.03.19-1) unstable; urgency=medium * Makefile: bump version diff -Nru stress-ng-0.03.19/Makefile stress-ng-0.03.20/Makefile --- stress-ng-0.03.19/Makefile 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/Makefile 2015-02-26 17:18:14.000000000 +0000 @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION=0.03.19 +VERSION=0.03.20 # # Codename "severely stressed silicon" # diff -Nru stress-ng-0.03.19/sched.c stress-ng-0.03.20/sched.c --- stress-ng-0.03.19/sched.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/sched.c 2015-02-26 17:18:14.000000000 +0000 @@ -36,6 +36,44 @@ #if (defined(_POSIX_PRIORITY_SCHEDULING) || defined(__linux__)) && !defined(__OpenBSD__) /* + * get_sched_name() + * convert sched class to human readable string + */ +static const char *get_sched_name(const int sched) +{ + switch (sched) { +#if defined(SCHED_IDLE) + case SCHED_IDLE: + return "idle"; +#endif +#if defined(SCHED_FIFO) + case SCHED_FIFO: + return "fifo"; +#endif +#if defined(SCHED_RR) + case SCHED_RR: + return "rr"; +#endif +#if defined(SCHED_OTHER) + case SCHED_OTHER: + return "other"; +#endif +#if defined(SCHED_BATCH) + case SCHED_BATCH: + return "batch"; +#endif +#if defined(SCHED_DEADLINE) + case SCHED_DEADLINE: + return "deadline"; +#endif + default: + return "unknown"; + } +} +#endif + +#if (defined(_POSIX_PRIORITY_SCHEDULING) || defined(__linux__)) && !defined(__OpenBSD__) +/* * set_sched() * are sched settings valid, if so, set them */ @@ -46,35 +84,52 @@ #endif int rc; struct sched_param param; + const char *name = get_sched_name(sched); + + memset(¶m, 0, sizeof(param)); switch (sched) { case UNDEFINED: /* No preference, don't set */ return; #if defined(SCHED_FIFO) || defined(SCHED_RR) +#if defined(SCHED_FIFO) case SCHED_FIFO: +#endif +#if defined(SCHED_RR) case SCHED_RR: +#endif min = sched_get_priority_min(sched); max = sched_get_priority_max(sched); - if ((sched_priority == UNDEFINED) || - (sched_priority > max) || - (sched_priority < min)) { + + param.sched_priority = sched_priority; + + if (param.sched_priority == UNDEFINED) { + if (opt_flags & OPT_FLAGS_AGGRESSIVE) + param.sched_priority = max; + else + param.sched_priority = (max - min) / 2; + pr_inf(stderr, "priority not given, defaulting to %d\n", + param.sched_priority); + } + if ((param.sched_priority < min) || (param.sched_priority > max)) { fprintf(stderr, "Scheduler priority level must be set between %d and %d\n", min, max); exit(EXIT_FAILURE); } - param.sched_priority = sched_priority; + pr_dbg(stderr, "setting scheduler class '%s', priority %d\n", + name, param.sched_priority); break; #endif default: - if (sched_priority != UNDEFINED) - fprintf(stderr, "Cannot set sched priority for chosen scheduler, defaulting to 0\n"); param.sched_priority = 0; + if (sched_priority != UNDEFINED) + pr_inf(stderr, "ignoring priority level for scheduler class '%s'\n", name); + pr_dbg(stderr, "setting scheduler class '%s'\n", name); + break; } - pr_dbg(stderr, "setting scheduler class %d, priority %d\n", - sched, param.sched_priority); rc = sched_setscheduler(getpid(), sched, ¶m); if (rc < 0) { - fprintf(stderr, "Cannot set scheduler priority: errno=%d (%s)\n", + fprintf(stderr, "Cannot set scheduler: errno=%d (%s)\n", errno, strerror(errno)); exit(EXIT_FAILURE); } @@ -113,6 +168,10 @@ if (!strcmp("rr", str)) return SCHED_RR; #endif +#ifdef SCHED_DEADLINE + if (!strcmp("deadline", str)) + return SCHED_DEADLINE; +#endif if (strcmp("which", str)) fprintf(stderr, "Invalid sched option: %s\n", str); fprintf(stderr, "Available scheduler options are:" @@ -122,6 +181,9 @@ #ifdef SCHED_BATCH " batch" #endif +#ifdef SCHED_DEADLINE + " deadline" +#endif #ifdef SCHED_IDLE " idle" #endif diff -Nru stress-ng-0.03.19/stress-affinity.c stress-ng-0.03.20/stress-affinity.c --- stress-ng-0.03.19/stress-affinity.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-affinity.c 2015-02-26 17:18:14.000000000 +0000 @@ -58,7 +58,8 @@ CPU_ZERO(&mask); CPU_SET(cpu, &mask); if (sched_setaffinity(0, sizeof(mask), &mask) < 0) { - pr_fail(stderr, "failed to move to CPU %lu\n", cpu); + pr_fail(stderr, "%s: failed to move to CPU %lu\n", + name, cpu); } else { /* Now get and check */ CPU_ZERO(&mask); @@ -66,7 +67,8 @@ sched_getaffinity(0, sizeof(mask), &mask); if ((opt_flags & OPT_FLAGS_VERIFY) && (!CPU_ISSET(cpu, &mask))) - pr_fail(stderr, "failed to move to CPU %lu\n", cpu); + pr_fail(stderr, "%s: failed to move to CPU %lu\n", + name, cpu); } (*counter)++; } while (opt_do_run && (!max_ops || *counter < max_ops)); diff -Nru stress-ng-0.03.19/stress-aio.c stress-ng-0.03.20/stress-aio.c --- stress-ng-0.03.19/stress-aio.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-aio.c 2015-02-26 17:18:14.000000000 +0000 @@ -107,7 +107,7 @@ * aio_issue_cancel() * cancel an in-progress async I/O request */ -static void aio_issue_cancel(io_req_t *io_req) +static void aio_issue_cancel(const char *name, io_req_t *io_req) { int ret; @@ -121,12 +121,12 @@ case AIO_ALLDONE: break; case AIO_NOTCANCELED: - pr_dbg(stderr, "async I/O request %d not cancelled\n", - io_req->request); + pr_dbg(stderr, "%s: async I/O request %d not cancelled\n", + name, io_req->request); break; default: - pr_err(stderr, "%d error: %d %s\n", - io_req->request, + pr_err(stderr, "%s: %d error: %d %s\n", + name, io_req->request, errno, strerror(errno)); } } @@ -136,31 +136,38 @@ * construct an AIO request and action it */ static int issue_aio_request( + const char *name, const int fd, const off_t offset, io_req_t *const io_req, const int request, int (*aio_func)(struct aiocb *aiocbp) ) { - int ret; + while (opt_do_run) { + int ret; - io_req->request = request; - io_req->status = EINPROGRESS; - io_req->aiocb.aio_fildes = fd; - io_req->aiocb.aio_buf = io_req->buffer; - io_req->aiocb.aio_nbytes = BUFFER_SZ; - io_req->aiocb.aio_reqprio = 0; - io_req->aiocb.aio_offset = offset; - io_req->aiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL; - io_req->aiocb.aio_sigevent.sigev_signo = SIGUSR1; - io_req->aiocb.aio_sigevent.sigev_value.sival_ptr = io_req; - - ret = aio_func(&io_req->aiocb); - if (ret < 0) { - pr_err(stderr, "failed to issue aio request: %d (%s)\n", - errno, strerror(errno)); + io_req->request = request; + io_req->status = EINPROGRESS; + io_req->aiocb.aio_fildes = fd; + io_req->aiocb.aio_buf = io_req->buffer; + io_req->aiocb.aio_nbytes = BUFFER_SZ; + io_req->aiocb.aio_reqprio = 0; + io_req->aiocb.aio_offset = offset; + io_req->aiocb.aio_sigevent.sigev_notify = SIGEV_SIGNAL; + io_req->aiocb.aio_sigevent.sigev_signo = SIGUSR1; + io_req->aiocb.aio_sigevent.sigev_value.sival_ptr = io_req; + + ret = aio_func(&io_req->aiocb); + if (ret < 0) { + if ((errno == EAGAIN) || (errno == EINTR)) + continue; + pr_err(stderr, "%s: failed to issue aio request: %d (%s)\n", + name, errno, strerror(errno)); + } + return ret; } - return ret; + /* Given up */ + return -1; } /* @@ -210,14 +217,14 @@ /* Kick off requests */ for (i = 0; i < opt_aio_requests; i++) { aio_fill_buffer(i, io_reqs[i].buffer, BUFFER_SZ); - if (issue_aio_request(fd, (off_t)i * BUFFER_SZ, &io_reqs[i], i, aio_write) < 0) + if (issue_aio_request(name, fd, (off_t)i * BUFFER_SZ, &io_reqs[i], i, aio_write) < 0) goto cancel; } do { usleep(250000); /* wait until a signal occurs */ - for (i = 0; i < opt_aio_requests; i++) { + for (i = 0; opt_do_run && (i < opt_aio_requests); i++) { if (io_reqs[i].status != EINPROGRESS) continue; @@ -227,7 +234,7 @@ case 0: /* Succeeded or cancelled, so redo another */ (*counter)++; - if (issue_aio_request(fd, (off_t)i * BUFFER_SZ, &io_reqs[i], i, + if (issue_aio_request(name, fd, (off_t)i * BUFFER_SZ, &io_reqs[i], i, (mwc() & 0x20) ? aio_read : aio_write) < 0) goto cancel; break; @@ -235,7 +242,7 @@ break; default: /* Something went wrong */ - pr_failed_err(name, "aio_error"); + pr_failed_errno(name, "aio_error", io_reqs[i].status); goto cancel; } } @@ -245,13 +252,13 @@ cancel: for (i = 0; i < opt_aio_requests; i++) { - aio_issue_cancel(&io_reqs[i]); + aio_issue_cancel(name, &io_reqs[i]); total += io_reqs[i].count; } (void)close(fd); finish: - pr_dbg(stderr, "total of %" PRIu64 " async I/O signals caught (instance %d)\n", - total, instance); + pr_dbg(stderr, "%s: total of %" PRIu64 " async I/O signals caught (instance %d)\n", + name, total, instance); (void)stress_temp_dir_rm(name, pid, instance); free(io_reqs); return rc; diff -Nru stress-ng-0.03.19/stress-bigheap.c stress-ng-0.03.20/stress-bigheap.c --- stress-ng-0.03.19/stress-bigheap.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-bigheap.c 2015-02-26 17:18:14.000000000 +0000 @@ -160,8 +160,9 @@ if (!opt_do_run) goto abort; if (*tmp != (uint8_t)i) - pr_fail(stderr, "byte at location %p was 0x%" PRIx8 - " instead of 0x%" PRIx8 "\n", u8ptr, *tmp, (uint8_t)i); + pr_fail(stderr, "%s: byte at location %p was 0x%" PRIx8 + " instead of 0x%" PRIx8 "\n", + name, u8ptr, *tmp, (uint8_t)i); } } diff -Nru stress-ng-0.03.19/stress-bsearch.c stress-ng-0.03.20/stress-bsearch.c --- stress-ng-0.03.19/stress-bsearch.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-bsearch.c 2015-02-26 17:18:14.000000000 +0000 @@ -122,10 +122,10 @@ result = bsearch(ptr, data, n, sizeof(*ptr), cmp); if (opt_flags & OPT_FLAGS_VERIFY) { if (result == NULL) - pr_fail(stderr, "element %zu could not be found\n", i); + pr_fail(stderr, "%s: element %zu could not be found\n", name, i); else if (*result != *ptr) - pr_fail(stderr, "element %zu found %" PRIu32 ", expecting %" PRIu32 "\n", - i, *result, *ptr); + pr_fail(stderr, "%s: element %zu found %" PRIu32 ", expecting %" PRIu32 "\n", + name, i, *result, *ptr); } } (*counter)++; diff -Nru stress-ng-0.03.19/stress-chmod.c stress-ng-0.03.20/stress-chmod.c --- stress-ng-0.03.19/stress-chmod.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-chmod.c 2015-02-26 17:18:14.000000000 +0000 @@ -178,7 +178,7 @@ for (i = 0; modes[i]; i++) { mask |= modes[i]; if (do_fchmod(fd, i, mask, all_mask) < 0) { - pr_fail(stderr, "%s fchmod: errno=%d (%s)\n", + pr_fail(stderr, "%s: fchmod: errno=%d (%s)\n", name, errno, strerror(errno)); } if (do_chmod(filename, i, mask, all_mask) < 0) { @@ -187,7 +187,7 @@ rc = EXIT_SUCCESS; goto tidy; } - pr_fail(stderr, "%s chmod: errno=%d (%s)\n", + pr_fail(stderr, "%s: chmod: errno=%d (%s)\n", name, errno, strerror(errno)); } } diff -Nru stress-ng-0.03.19/stress-cpu.c stress-ng-0.03.20/stress-cpu.c --- stress-ng-0.03.19/stress-cpu.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-cpu.c 2015-02-26 17:18:14.000000000 +0000 @@ -61,7 +61,7 @@ /* * the CPU stress test has different classes of cpu stressor */ -typedef void (*stress_cpu_func)(void); +typedef void (*stress_cpu_func)(const char *name); typedef struct { const char *name; /* human readable form of stressor */ @@ -84,7 +84,7 @@ * stress_cpu_sqrt() * stress CPU on square roots */ -static void stress_cpu_sqrt(void) +static void stress_cpu_sqrt(const char *name) { int i; @@ -93,7 +93,7 @@ double r = sqrt((double)rnd) * sqrt((double)rnd); if ((opt_flags & OPT_FLAGS_VERIFY) && (uint64_t)rint(r) != rnd) { - pr_fail(stderr, "sqrt error detected on sqrt(%" PRIu64 ")\n", rnd); + pr_fail(stderr, "%s: sqrt error detected on sqrt(%" PRIu64 ")\n", name, rnd); if (!opt_do_run) break; } @@ -104,14 +104,14 @@ * We need to stop gcc optimising out the loop additions.. sigh */ #if __GNUC__ && !defined(__clang__) -static void stress_cpu_loop(void) __attribute__((optimize("-O0"))); +static void stress_cpu_loop(const char *) __attribute__((optimize("-O0"))); #endif /* * stress_cpu_loop() * simple CPU busy loop */ -static void stress_cpu_loop(void) +static void stress_cpu_loop(const char *name) { uint32_t i, i_sum = 0; const uint32_t sum = 134209536UL; @@ -123,16 +123,16 @@ #endif } if ((opt_flags & OPT_FLAGS_VERIFY) && (i_sum != sum)) - pr_fail(stderr, "cpu loop 0..16383 sum was %" PRIu32 " and " + pr_fail(stderr, "%s: cpu loop 0..16383 sum was %" PRIu32 " and " "did not match the expected value of %" PRIu32 "\n", - i_sum, sum); + name, i_sum, sum); } /* * stress_cpu_gcd() * compute Greatest Common Divisor */ -static void stress_cpu_gcd(void) +static void stress_cpu_gcd(const char *name) { uint32_t i, i_sum = 0; const uint32_t sum = 63000868UL; @@ -151,7 +151,7 @@ #endif } if ((opt_flags & OPT_FLAGS_VERIFY) && (i_sum != sum)) - pr_fail(stderr, "gcd error detected, failed modulo or assigment operations\n"); + pr_fail(stderr, "%s: gcd error detected, failed modulo or assigment operations\n", name); } /* @@ -159,7 +159,7 @@ * various bit manipulation hacks from bithacks * https://graphics.stanford.edu/~seander/bithacks.html */ -static void stress_cpu_bitops(void) +static void stress_cpu_bitops(const char *name) { uint32_t i, i_sum = 0; const uint32_t sum = 0x8aadcaab; @@ -205,18 +205,20 @@ } } if ((opt_flags & OPT_FLAGS_VERIFY) && (i_sum != sum)) - pr_fail(stderr, "bitops error detected, failed bitops operations\n"); + pr_fail(stderr, "%s: bitops error detected, failed bitops operations\n", name); } /* * stress_cpu_trig() * simple sin, cos trig functions */ -static void stress_cpu_trig(void) +static void stress_cpu_trig(const char *name) { int i; long double d_sum = 0.0; + (void)name; + for (i = 0; i < 1500; i++) { long double theta = (2.0 * M_PI * (double)i)/1500.0; { @@ -246,11 +248,13 @@ * stress_cpu_hyperbolic() * simple hyperbolic sinh, cosh functions */ -static void stress_cpu_hyperbolic(void) +static void stress_cpu_hyperbolic(const char *name) { int i; double d_sum = 0.0; + (void)name; + for (i = 0; i < 1500; i++) { long double theta = (2.0 * M_PI * (double)i)/1500.0; { @@ -280,7 +284,7 @@ * stress_cpu_rand() * generate lots of pseudo-random integers */ -static void stress_cpu_rand(void) +static void stress_cpu_rand(const char *name) { int i; uint32_t i_sum = 0; @@ -291,14 +295,14 @@ i_sum += mwc(); if ((opt_flags & OPT_FLAGS_VERIFY) && (i_sum != sum)) - pr_fail(stderr, "rand error detected, failed sum of pseudo-random values\n"); + pr_fail(stderr, "%s: rand error detected, failed sum of pseudo-random values\n", name); } /* * stress_cpu_nsqrt() * iterative Newton–Raphson square root */ -static void stress_cpu_nsqrt(void) +static void stress_cpu_nsqrt(const char *name) { int i; const long double precision = 1.0e-12; @@ -322,9 +326,9 @@ if (opt_flags & OPT_FLAGS_VERIFY) { if (j >= max_iter) - pr_fail(stderr, "Newton-Raphson sqrt computation took more iterations than expected\n"); + pr_fail(stderr, "%s: Newton-Raphson sqrt computation took more iterations than expected\n", name); if ((int)rintl(rt * rt) != i) - pr_fail(stderr, "Newton-Rapshon sqrt not accurate enough\n"); + pr_fail(stderr, "%s: Newton-Rapshon sqrt not accurate enough\n", name); } } } @@ -333,7 +337,7 @@ * stress_cpu_phi() * compute the Golden Ratio */ -static void stress_cpu_phi(void) +static void stress_cpu_phi(const char *name) { long double phi; /* Golden ratio */ const long double precision = 1.0e-15; @@ -359,7 +363,7 @@ if ((opt_flags & OPT_FLAGS_VERIFY) && (fabsl(phi - phi_) > precision)) - pr_fail(stderr, "Golden Ratio phi not accurate enough\n"); + pr_fail(stderr, "%s: Golden Ratio phi not accurate enough\n", name); } /* @@ -389,11 +393,13 @@ * stress_cpu_fft() * Fast Fourier Transform */ -static void stress_cpu_fft(void) +static void stress_cpu_fft(const char *name) { double complex buf[FFT_SIZE], tmp[FFT_SIZE]; int i; + (void)name; + for (i = 0; i < FFT_SIZE; i++) buf[i] = (double complex)(i % 63); @@ -405,7 +411,7 @@ * stress_cpu_euler() * compute e using series */ -static void stress_cpu_euler(void) +static void stress_cpu_euler(const char *name) { long double e = 1.0, last_e = e; long double fact = 1.0; @@ -420,7 +426,7 @@ } while ((n < 25) && (fabsl(e - last_e) > precision)); if ((opt_flags & OPT_FLAGS_VERIFY) && (n >= 25)) - pr_fail(stderr, "euler computation took more iterations than expected\n"); + pr_fail(stderr, "%s: Euler computation took more iterations than expected\n", name); } /* @@ -451,6 +457,7 @@ */ static void stress_cpu_hash_generic( const char *name, + const char *hash_name, uint32_t (*hash_func)(const char *str), const uint32_t result) { @@ -469,8 +476,8 @@ i_sum += hash_func(buffer); } if ((opt_flags & OPT_FLAGS_VERIFY) && (i_sum != result)) - pr_fail(stderr, "%s error detected, failed hash %s sum\n", - name, name); + pr_fail(stderr, "%s: %s error detected, failed hash %s sum\n", + name, hash_name, hash_name); } @@ -500,7 +507,7 @@ * stress_cpu_jenkin() * multiple iterations on jenkin hash */ -static void stress_cpu_jenkin(void) +static void stress_cpu_jenkin(const char *name) { uint8_t buffer[128]; size_t i; @@ -513,7 +520,7 @@ i_sum += jenkin(buffer, sizeof(buffer)); if ((opt_flags & OPT_FLAGS_VERIFY) && (i_sum != sum)) - pr_fail(stderr, "jenkin error detected, failed hash jenkin sum\n"); + pr_fail(stderr, "%s: jenkin error detected, failed hash jenkin sum\n", name); } /* @@ -540,9 +547,9 @@ * stress_cpu_pjw() * stress test hash pjw */ -static void stress_cpu_pjw(void) +static void stress_cpu_pjw(const char *name) { - stress_cpu_hash_generic("pjw", pjw, 0xa89a91c0); + stress_cpu_hash_generic(name, "pjw", pjw, 0xa89a91c0); } /* @@ -565,9 +572,9 @@ * stress_cpu_djb2a() * stress test hash djb2a */ -static void stress_cpu_djb2a(void) +static void stress_cpu_djb2a(const char *name) { - stress_cpu_hash_generic("djb2a", djb2a, 0x6a60cb5a); + stress_cpu_hash_generic(name, "djb2a", djb2a, 0x6a60cb5a); } /* @@ -591,9 +598,9 @@ * stress_cpu_fnv1a() * stress test hash fnv1a */ -static void stress_cpu_fnv1a(void) +static void stress_cpu_fnv1a(const char *name) { - stress_cpu_hash_generic("fnv1a", fnv1a, 0x8ef17e80); + stress_cpu_hash_generic(name, "fnv1a", fnv1a, 0x8ef17e80); } /* @@ -615,16 +622,16 @@ * stress_cpu_sdbm() * stress test hash sdbm */ -static void stress_cpu_sdbm(void) +static void stress_cpu_sdbm(const char *name) { - stress_cpu_hash_generic("sdbm", sdbm, 0x46357819); + stress_cpu_hash_generic(name, "sdbm", sdbm, 0x46357819); } /* * stress_cpu_idct() * compute 8x8 Inverse Discrete Cosine Transform */ -static void stress_cpu_idct(void) +static void stress_cpu_idct(const char *name) { const double invsqrt2 = 1.0 / sqrt(2.0); const double pi_over_16 = M_PI / 16.0; @@ -667,8 +674,8 @@ for (j = 0; j < sz; j++) { if (((int)idct[i][j] != 255) && (opt_flags & OPT_FLAGS_VERIFY)) { - pr_fail(stderr, "IDCT error detected, IDCT[%d][%d] was %d, expecting 255\n", - i, j, (int)idct[i][j]); + pr_fail(stderr, "%s: IDCT error detected, IDCT[%d][%d] was %d, expecting 255\n", + name, i, j, (int)idct[i][j]); } if (!opt_do_run) return; @@ -713,7 +720,7 @@ * Generic int stressor macro */ #define stress_cpu_int(_type, _sz, _a, _b, _c1, _c2, _c3) \ -static void stress_cpu_int ## _sz(void) \ +static void stress_cpu_int ## _sz(const char *name) \ { \ const _type mask = ~0; \ const _type a_final = _a; \ @@ -734,9 +741,9 @@ \ if ((opt_flags & OPT_FLAGS_VERIFY) && \ ((a != a_final) || (b != b_final))) \ - pr_fail(stderr, "int" # _sz " error detected, " \ + pr_fail(stderr, "%s: int" # _sz " error detected, " \ "failed int" # _sz \ - " math operations\n"); \ + " math operations\n", name); \ } \ /* For compilers that support int128 .. */ @@ -790,11 +797,13 @@ * Generic floating point stressor macro */ #define stress_cpu_fp(_type, _name, _sin, _cos) \ -static void stress_cpu_ ## _name(void) \ +static void stress_cpu_ ## _name(const char *name) \ { \ int i; \ _type a = 0.18728, b = mwc(), c = mwc(), d; \ \ + (void)name; \ + \ for (i = 0; i < 1000; i++) { \ float_ops(_type, a, b, c, d, \ _sin, _cos); \ @@ -815,13 +824,15 @@ * Generic complex stressor macro */ #define stress_cpu_complex(_type, _name, _csin, _ccos) \ -static void stress_cpu_ ## _name(void) \ +static void stress_cpu_ ## _name(const char *name) \ { \ int i; \ _type a = 0.18728 + I * 0.2762, \ b = mwc() - I * 0.11121, \ c = mwc() + I * mwc(), d; \ \ + (void)name; \ + \ for (i = 0; i < 1000; i++) { \ float_ops(_type, a, b, c, d, \ _csin, _ccos); \ @@ -885,7 +896,7 @@ */ #define stress_cpu_int_fp(_inttype, _sz, _ftype, _name, _a, _b, \ _c1, _c2, _c3, _sinf, _cosf) \ -static void stress_cpu_int ## _sz ## _ ## _name(void) \ +static void stress_cpu_int ## _sz ## _ ## _name(const char *name)\ { \ int i; \ _inttype int_a, int_b; \ @@ -908,9 +919,9 @@ } \ if ((opt_flags & OPT_FLAGS_VERIFY) && \ ((int_a != a_final) || (int_b != b_final))) \ - pr_fail(stderr, "int" # _sz " error detected, " \ + pr_fail(stderr, "%s: int" # _sz " error detected, "\ "failed int" # _sz \ - " math operations\n"); \ + " math operations\n", name); \ \ double_put(flt_a + flt_b + flt_c + flt_d); \ } @@ -973,7 +984,7 @@ * stress_cpu_rgb() * CCIR 601 RGB to YUV to RGB conversion */ -static void stress_cpu_rgb(void) +static void stress_cpu_rgb(const char *name) { int i; uint32_t rgb = mwc() & 0xffffff; @@ -981,6 +992,8 @@ uint8_t g = rgb >> 8; uint8_t b = rgb; + (void)name; + /* Do a 1000 colours starting from the rgb seed */ for (i = 0; i < 1000; i++) { float y,u,v; @@ -1007,7 +1020,7 @@ * stress_cpu_matrix_prod(void) * matrix product */ -static void stress_cpu_matrix_prod(void) +static void stress_cpu_matrix_prod(const char *name) { int i, j, k; const int n = 128; @@ -1016,6 +1029,8 @@ long double v = 1 / (long double)((uint32_t)~0); long double sum = 0.0; + (void)name; + for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { a[i][j] = (long double)mwc() * v; @@ -1042,7 +1057,7 @@ * stress_cpu_fibonacci() * compute fibonacci series */ -static void stress_cpu_fibonacci(void) +static void stress_cpu_fibonacci(const char *name) { const uint64_t fn_res = 0xa94fad42221f2702ULL; register uint64_t f1 = 0, f2 = 1, fn; @@ -1054,7 +1069,7 @@ } while (!(fn & 0x8000000000000000ULL)); if ((opt_flags & OPT_FLAGS_VERIFY) && (fn_res != fn)) - pr_fail(stderr, "fibonacci error detected, summation or assignment failure\n"); + pr_fail(stderr, "%s: fibonacci error detected, summation or assignment failure\n", name); } /* @@ -1062,7 +1077,7 @@ * compute the constant psi, * the reciprocal Fibonacci constant */ -static void stress_cpu_psi(void) +static void stress_cpu_psi(const char *name) { long double f1 = 0.0, f2 = 1.0; long double psi = 0.0, last_psi; @@ -1081,9 +1096,9 @@ if (opt_flags & OPT_FLAGS_VERIFY) { if (fabsl(psi - PSI) > 1.0e-15) - pr_fail(stderr, "calculation of reciprocal Fibonacci constant phi not as accurate as expected\n"); + pr_fail(stderr, "%s: calculation of reciprocal Fibonacci constant phi not as accurate as expected\n", name); if (i >= max_iter) - pr_fail(stderr, "calculation of reciprocal Fibonacci constant took more iterations than expected\n"); + pr_fail(stderr, "%s: calculation of reciprocal Fibonacci constant took more iterations than expected\n", name); } double_put(psi); @@ -1093,7 +1108,7 @@ * stress_cpu_ln2 * compute ln(2) using series */ -static void stress_cpu_ln2(void) +static void stress_cpu_ln2(const char *name) { long double ln2 = 0.0, last_ln2 = 0.0; long double precision = 1.0e-7; @@ -1115,7 +1130,7 @@ } while ((n < max_iter) && (fabsl(ln2 - last_ln2) > precision)); if ((opt_flags & OPT_FLAGS_VERIFY) && (n >= max_iter)) - pr_fail(stderr, "calculation of ln(2) took more iterations than expected\n"); + pr_fail(stderr, "%s: calculation of ln(2) took more iterations than expected\n", name); double_put(ln2); } @@ -1138,23 +1153,25 @@ * stress_cpu_ackermann * compute ackermann function */ -static void stress_cpu_ackermann(void) +static void stress_cpu_ackermann(const char *name) { uint32_t a = ackermann(3, 10); if ((opt_flags & OPT_FLAGS_VERIFY) && (a != 0x1ffd)) - pr_fail(stderr, "ackermann error detected, ackermann(3,10) miscalculated\n"); + pr_fail(stderr, "%s: ackermann error detected, ackermann(3,10) miscalculated\n", name); } /* * stress_cpu_explog * compute exp(log(n)) */ -static void stress_cpu_explog(void) +static void stress_cpu_explog(const char *name) { uint32_t i; double n = 1e6; + (void)name; + for (i = 1; i < 100000; i++) n = exp(log(n) / 1.00002); } @@ -1163,7 +1180,7 @@ * Undocumented gcc-ism, force -O0 optimisation */ #if __GNUC__ && !defined(__clang__) -static void stress_cpu_jmp(void) __attribute__((optimize("-O0"))); +static void stress_cpu_jmp(const char *name) __attribute__((optimize("-O0"))); #endif /* @@ -1181,10 +1198,12 @@ * stress_cpu_jmp * jmp conditionals */ -static void stress_cpu_jmp(void) +static void stress_cpu_jmp(const char *name) { register int i, next = 0; + (void)name; + for (i = 1; i < 1000; i++) { /* Force lots of compare jmps */ JMP(next, ==, 1, 2, 3); @@ -1246,11 +1265,13 @@ * stress_cpu_crc16 * compute 1024 rounds of CCITT CRC16 */ -static void stress_cpu_crc16(void) +static void stress_cpu_crc16(const char *name) { uint8_t buffer[1024]; size_t i; + (void)name; + random_buffer(buffer, sizeof(buffer)); for (i = 0; i < sizeof(buffer); i++) uint64_put(ccitt_crc16(buffer, i)); @@ -1279,11 +1300,13 @@ * stress_cpu_zeta() * stress test Zeta(2.0)..Zeta(10.0) */ -static void stress_cpu_zeta(void) +static void stress_cpu_zeta(const char *name) { long double precision = 0.00000001; double f; + (void)name; + for (f = 2.0; f < 11.0; f += 1.0) double_put(zeta(f, precision)); } @@ -1292,7 +1315,7 @@ * stress_cpu_gamma() * stress Euler–Mascheroni constant gamma */ -static void stress_cpu_gamma(void) +static void stress_cpu_gamma(const char *name) { long double precision = 1.0e-10; long double sum = 0.0, k = 1.0, gamma = 0.0, gammaold; @@ -1308,9 +1331,9 @@ if (opt_flags & OPT_FLAGS_VERIFY) { if (fabsl(gamma - GAMMA) > 1.0e-5) - pr_fail(stderr, "calculation of Euler-Mascheroni constant not as accurate as expected\n"); + pr_fail(stderr, "%s: calculation of Euler-Mascheroni constant not as accurate as expected\n", name); if (k > 80000.0) - pr_fail(stderr, "calculation of Euler-Mascheroni constant took more iterations than expected\n"); + pr_fail(stderr, "%s: calculation of Euler-Mascheroni constant took more iterations than expected\n", name); } } @@ -1321,7 +1344,7 @@ * Introduction to Signal Processing, * Prentice-Hall, 1995, ISBN: 0-13-209172-0. */ -static void stress_cpu_correlate(void) +static void stress_cpu_correlate(const char *name) { const size_t data_len = 16384; const size_t corr_len = data_len / 16; @@ -1329,6 +1352,8 @@ double data_average = 0.0; double data[data_len], corr[corr_len + 1]; + (void)name; + /* Generate some random data */ for (i = 0; i < data_len; i++) { data[i] = mwc(); @@ -1353,7 +1378,7 @@ * stress_cpu_sieve() * slightly optimised Sieve of Eratosthenes */ -static void stress_cpu_sieve(void) +static void stress_cpu_sieve(const char *name) { const uint32_t nsqrt = sqrt(SIEVE_SIZE); uint32_t sieve[(SIEVE_SIZE + 31) / 32]; @@ -1371,7 +1396,7 @@ j++; } if ((opt_flags & OPT_FLAGS_VERIFY) && (j != 664579)) - pr_fail(stderr, "sieve error detected, number of primes has been miscalculated\n"); + pr_fail(stderr, "%s: sieve error detected, number of primes has been miscalculated\n", name); } /* @@ -1398,7 +1423,7 @@ * stress_cpu_prime() * */ -static void stress_cpu_prime(void) +static void stress_cpu_prime(const char *name) { uint32_t i, nprimes = 0; @@ -1408,14 +1433,14 @@ } if ((opt_flags & OPT_FLAGS_VERIFY) && (nprimes != 78498)) - pr_fail(stderr, "prime error detected, number of primes between 0 and 1000000 miscalculated\n"); + pr_fail(stderr, "%s: prime error detected, number of primes between 0 and 1000000 miscalculated\n", name); } /* * stress_cpu_gray() * compute gray codes */ -static void stress_cpu_gray(void) +static void stress_cpu_gray(const char *name) { uint32_t i; uint64_t sum = 0; @@ -1433,8 +1458,8 @@ sum += gray_code; } if ((opt_flags & OPT_FLAGS_VERIFY) && (sum != 0xffff0000)) - pr_fail(stderr, "gray code error detected, sum of gray codes " - "between 0x00000 and 0x10000 miscalculated\n"); + pr_fail(stderr, "%s: gray code error detected, sum of gray codes " + "between 0x00000 and 0x10000 miscalculated\n", name); } /* @@ -1462,12 +1487,12 @@ * stress_cpu_hanoi * stress with recursive Towers of Hanoi */ -static void stress_cpu_hanoi(void) +static void stress_cpu_hanoi(const char *name) { uint32_t n = hanoi(20, 'X', 'Y', 'Z'); if ((opt_flags & OPT_FLAGS_VERIFY) && (n != 1048576)) - pr_fail(stderr, "number of hanoi moves different from the expected number\n"); + pr_fail(stderr, "%s: number of hanoi moves different from the expected number\n", name); uint64_put(n); } @@ -1492,7 +1517,7 @@ * compute pi using the Srinivasa Ramanujan * fast convergence algorithm */ -static void stress_cpu_pi(void) +static void stress_cpu_pi(const char *name) { long double s = 0.0, pi = 0.0, last_pi = 0.0; const long double precision = 1.0e-20; @@ -1512,9 +1537,9 @@ /* Quick sanity checks */ if (opt_flags & OPT_FLAGS_VERIFY) { if (k >= max_iter) - pr_fail(stderr, "number of iterations to compute pi was more than expected\n"); + pr_fail(stderr, "%s: number of iterations to compute pi was more than expected\n", name); if (fabsl(pi - M_PI) > 1.0e-15) - pr_fail(stderr, "accuracy of computed pi is not as good as expected\n"); + pr_fail(stderr, "%s: accuracy of computed pi is not as good as expected\n", name); } double_put(pi); @@ -1525,7 +1550,7 @@ * compute the constant omega * See http://en.wikipedia.org/wiki/Omega_constant */ -static void stress_cpu_omega(void) +static void stress_cpu_omega(const char *name) { long double omega = 0.5, last_omega = 0.0; const long double precision = 1.0e-20; @@ -1541,9 +1566,9 @@ if (opt_flags & OPT_FLAGS_VERIFY) { if (n >= max_iter) - pr_fail(stderr, "number of iterations to compute omega was more than expected\n"); + pr_fail(stderr, "%s: number of iterations to compute omega was more than expected\n", name); if (fabsl(omega - OMEGA) > 1.0e-16) - pr_fail(stderr, "accuracy of computed omega is not as good as expected\n"); + pr_fail(stderr, "%s: accuracy of computed omega is not as good as expected\n", name); } double_put(omega); @@ -1611,7 +1636,7 @@ * stress_cpu_hamming() * compute hamming code on 65536 x 4 nybbles */ -static void stress_cpu_hamming(void) +static void stress_cpu_hamming(const char *name) { uint32_t i; uint32_t sum = 0; @@ -1629,18 +1654,18 @@ } if ((opt_flags & OPT_FLAGS_VERIFY) && (sum != 0xffff8000)) - pr_fail(stderr, "hamming error detected, sum of 65536 hamming codes not correct\n"); + pr_fail(stderr, "%s: hamming error detected, sum of 65536 hamming codes not correct\n", name); } /* * stress_cpu_all() * iterate over all cpu stressors */ -static void stress_cpu_all(void) +static void stress_cpu_all(const char *name) { static int i = 1; /* Skip over stress_cpu_all */ - cpu_methods[i++].func(); + cpu_methods[i++].func(name); if (!cpu_methods[i].func) i = 1; } @@ -1769,7 +1794,7 @@ */ if (opt_cpu_load == 100) { do { - (void)func(); + (void)func(name); (*counter)++; } while (opt_do_run && (!max_ops || *counter < max_ops)); return EXIT_SUCCESS; @@ -1797,7 +1822,7 @@ gettimeofday(&tv1, NULL); for (j = 0; j < 64; j++) { - (void)func(); + (void)func(name); if (!opt_do_run) break; (*counter)++; diff -Nru stress-ng-0.03.19/stress-fallocate.c stress-ng-0.03.20/stress-fallocate.c --- stress-ng-0.03.19/stress-fallocate.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-fallocate.c 2015-02-26 17:18:14.000000000 +0000 @@ -108,9 +108,10 @@ struct stat buf; if (fstat(fd, &buf) < 0) - pr_fail(stderr, "fstat on file failed"); + pr_fail(stderr, "%s: fstat on file failed", name); else if (buf.st_size != opt_fallocate_bytes) - pr_fail(stderr, "file size does not match size the expected file size\n"); + pr_fail(stderr, "%s: file size %jd does not match size the expected file size of %jd\n", + name, (intmax_t)buf.st_size, (intmax_t)opt_fallocate_bytes); } if (ftruncate(fd, 0) < 0) @@ -123,9 +124,11 @@ struct stat buf; if (fstat(fd, &buf) < 0) - pr_fail(stderr, "fstat on file failed"); + pr_fail(stderr, "%s: fstat on file failed", name); else if (buf.st_size != (off_t)0) - pr_fail(stderr, "file size does not match size the expected file size\n"); + pr_fail(stderr, "%s: file size %jd does not match size the expected file size of 0\n", + name, (intmax_t)buf.st_size); + } if (ftruncate(fd, opt_fallocate_bytes) < 0) @@ -155,6 +158,9 @@ break; (void)fsync(fd); } + if (ftruncate(fd, 0) < 0) + ftrunc_errs++; + (void)fsync(fd); } #endif (*counter)++; diff -Nru stress-ng-0.03.19/stress-fault.c stress-ng-0.03.20/stress-fault.c --- stress-ng-0.03.19/stress-fault.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-fault.c 2015-02-26 17:18:14.000000000 +0000 @@ -129,8 +129,8 @@ (void)stress_temp_dir_rm(name, pid, instance); if (!getrusage(RUSAGE_SELF, &usage)) { - pr_dbg(stderr, "page faults: minor: %lu, major: %lu\n", - usage.ru_minflt, usage.ru_majflt); + pr_dbg(stderr, "%s: page faults: minor: %lu, major: %lu\n", + name, usage.ru_minflt, usage.ru_majflt); } return EXIT_SUCCESS; diff -Nru stress-ng-0.03.19/stress-fork.c stress-ng-0.03.20/stress-fork.c --- stress-ng-0.03.19/stress-fork.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-fork.c 2015-02-26 17:18:14.000000000 +0000 @@ -110,7 +110,7 @@ for (i = 0; i < fork_max; i++) { if ((pids[i] < 0) && (opt_flags & OPT_FLAGS_VERIFY)) { - pr_fail(stderr, "fork failed\n"); + pr_fail(stderr, "%s: fork failed\n", name); } } } while (opt_do_run && (!max_ops || *counter < max_ops)); diff -Nru stress-ng-0.03.19/stress-futex.c stress-ng-0.03.20/stress-futex.c --- stress-ng-0.03.19/stress-futex.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-futex.c 2015-02-26 17:18:14.000000000 +0000 @@ -94,8 +94,8 @@ ret = futex_wake(futex, 1); if (opt_flags & OPT_FLAGS_VERIFY) { if (ret < 0) - pr_fail(stderr, "futex wake failed: errno=%d (%s)\n", - errno, strerror(errno)); + pr_fail(stderr, "%s: futex wake failed: errno=%d (%s)\n", + name, errno, strerror(errno)); } } while (opt_do_run && (!max_ops || *counter < max_ops)); @@ -103,7 +103,7 @@ (void)kill(pid, SIGKILL); (void)waitpid(pid, &status, 0); - pr_dbg(stderr, "futex timeouts: %" PRIu64 "\n", *timeout); + pr_dbg(stderr, "%s: futex timeouts: %" PRIu64 "\n", name, *timeout); } else { do { /* Small timeout to force rapid timer wakeups */ @@ -123,8 +123,8 @@ } if ((ret < 0) && (opt_flags & OPT_FLAGS_VERIFY)) { - pr_fail(stderr, "futex wait failed: errno=%d (%s)\n", - errno, strerror(errno)); + pr_fail(stderr, "%s: futex wait failed: errno=%d (%s)\n", + name, errno, strerror(errno)); } (*counter)++; } while (opt_do_run && (!max_ops || *counter < max_ops)); diff -Nru stress-ng-0.03.19/stress-hdd.c stress-ng-0.03.20/stress-hdd.c --- stress-ng-0.03.19/stress-hdd.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-hdd.c 2015-02-26 17:18:14.000000000 +0000 @@ -105,7 +105,7 @@ (HDD_OPT_FADV_NORMAL | HDD_OPT_FADV_RND), POSIX_FADV_SEQUENTIAL, 0 }, #endif -#if defined(POSIX_FADV_RND) && !defined(__gnu_hurd__) +#if defined(POSIX_FADV_RANDOM) && !defined(__gnu_hurd__) { "fadv-rnd", HDD_OPT_FADV_RND, (HDD_OPT_FADV_NORMAL | HDD_OPT_FADV_SEQ), POSIX_FADV_RANDOM, 0 }, @@ -198,7 +198,7 @@ */ static int stress_hdd_advise(const char *name, const int fd, const int flags) { -#if (defined(POSIX_FADV_SEQ) || defined(POSIX_FADV_RND) || \ +#if (defined(POSIX_FADV_SEQ) || defined(POSIX_FADV_RANDOM) || \ defined(POSIX_FADV_NOREUSE) || defined(POSIX_FADV_WILLNEED) || \ defined(POSIX_FADV_DONTNEED)) && !defined(__gnu_hurd__) int i; @@ -239,7 +239,6 @@ int flags = O_CREAT | O_RDWR | O_TRUNC | opt_hdd_oflags; int fadvise_flags = opt_hdd_flags & HDD_OPT_FADV_MASK; - if (!set_hdd_bytes) { if (opt_flags & OPT_FLAGS_MAXIMIZE) opt_hdd_bytes = MAX_HDD_BYTES; @@ -254,12 +253,21 @@ opt_hdd_write_size = MIN_HDD_WRITE_SIZE; } + if (opt_hdd_bytes < opt_hdd_write_size) { + opt_hdd_bytes = opt_hdd_write_size; + pr_inf(stderr, "%s: increasing file size to write size of %" PRIu64 " bytes\n", + name, opt_hdd_bytes); + } + if (stress_temp_dir_mk(name, pid, instance) < 0) return EXIT_FAILURE; /* Must have some write option */ if ((opt_hdd_flags & HDD_OPT_WR_MASK) == 0) opt_hdd_flags |= HDD_OPT_WR_SEQ; + /* Must have some read option */ + if ((opt_hdd_flags & HDD_OPT_RD_MASK) == 0) + opt_hdd_flags |= HDD_OPT_RD_SEQ; ret = posix_memalign((void **)&buf, BUF_ALIGNMENT, (size_t)opt_hdd_write_size); if (ret || !buf) { @@ -281,23 +289,44 @@ pr_failed_err(name, "open"); goto finish; } + if (ftruncate(fd, (off_t)0) < 0) { + pr_failed_err(name, "ftruncate"); + (void)close(fd); + goto finish; + } (void)unlink(filename); - if (stress_hdd_advise(name, fd, fadvise_flags) < 0) + if (stress_hdd_advise(name, fd, fadvise_flags) < 0) { + (void)close(fd); goto finish; + } - /* Sequential Write */ - if (opt_hdd_flags & HDD_OPT_WR_SEQ) { + /* Random Write */ + if (opt_hdd_flags & HDD_OPT_WR_RND) { for (i = 0; i < opt_hdd_bytes; i += opt_hdd_write_size) { + size_t j; + + off_t offset = (i == 0) ? + opt_hdd_bytes : + (mwc() % opt_hdd_bytes) & ~511; ssize_t ret; -seq_wr_retry: + + if (lseek(fd, offset, SEEK_SET) < 0) { + pr_failed_err(name, "lseek"); + (void)close(fd); + goto finish; + } +rnd_wr_retry: if (!opt_do_run || (max_ops && *counter >= max_ops)) break; + for (j = 0; j < opt_hdd_write_size; j++) + buf[j] = (offset + j) & 0xff; + ret = write(fd, buf, (size_t)opt_hdd_write_size); if (ret <= 0) { if ((errno == EAGAIN) || (errno == EINTR)) - goto seq_wr_retry; + goto rnd_wr_retry; if (errno) { pr_failed_err(name, "write"); (void)close(fd); @@ -308,24 +337,21 @@ (*counter)++; } } - /* Random Write */ - if (opt_hdd_flags & HDD_OPT_WR_RND) { + /* Sequential Write */ + if (opt_hdd_flags & HDD_OPT_WR_SEQ) { for (i = 0; i < opt_hdd_bytes; i += opt_hdd_write_size) { - off_t offset = (mwc() % opt_hdd_bytes) & ~511; ssize_t ret; - - if (lseek(fd, offset, SEEK_SET) < 0) { - pr_failed_err(name, "lseek"); - (void)close(fd); - goto finish; - } -rnd_wr_retry: + size_t j; +seq_wr_retry: if (!opt_do_run || (max_ops && *counter >= max_ops)) break; + + for (j = 0; j < opt_hdd_write_size; j += 512) + buf[j] = (i + j) & 0xff; ret = write(fd, buf, (size_t)opt_hdd_write_size); if (ret <= 0) { if ((errno == EAGAIN) || (errno == EINTR)) - goto rnd_wr_retry; + goto seq_wr_retry; if (errno) { pr_failed_err(name, "write"); (void)close(fd); @@ -336,9 +362,11 @@ (*counter)++; } } + /* Sequential Read */ if (opt_hdd_flags & HDD_OPT_RD_SEQ) { uint64_t misreads = 0; + uint64_t baddata = 0; if (lseek(fd, 0, SEEK_SET) < 0) { pr_failed_err(name, "lseek"); @@ -365,18 +393,39 @@ if (ret != (ssize_t)opt_hdd_write_size) misreads++; + if (opt_flags & OPT_FLAGS_VERIFY) { + size_t j; + + for (j = 0; j < opt_hdd_write_size; j += 512) { + uint8_t v = (i + j) & 0xff; + if (opt_hdd_flags & HDD_OPT_WR_SEQ) { + /* Write seq has written to all of the file, so it should always be OK */ + if (buf[0] != v) + baddata++; + } else { + /* Write rnd has written to some of the file, so data either zero or OK */ + if (buf[0] != 0 && buf[0] != v) + baddata++; + } + } + } (*counter)++; } - pr_dbg(stderr, "%s: %" PRIu64 " incomplete reads\n", - name, misreads); + if (misreads) + pr_dbg(stderr, "%s: %" PRIu64 " incomplete sequential reads\n", + name, misreads); + if (baddata) + pr_fail(stderr, "%s: incorrect data found %" PRIu64 " times\n", + name, baddata); } /* Random Read */ if (opt_hdd_flags & HDD_OPT_RD_RND) { uint64_t misreads = 0; + uint64_t baddata = 0; for (i = 0; i < opt_hdd_bytes; i += opt_hdd_write_size) { ssize_t ret; - off_t offset = (mwc() % opt_hdd_bytes) & ~511; + off_t offset = (mwc() % (opt_hdd_bytes - opt_hdd_write_size)) & ~511; if (lseek(fd, offset, SEEK_SET) < 0) { pr_failed_err(name, "lseek"); @@ -400,12 +449,31 @@ if (ret != (ssize_t)opt_hdd_write_size) misreads++; + if (opt_flags & OPT_FLAGS_VERIFY) { + size_t j; + + for (j = 0; j < opt_hdd_write_size; j += 512) { + uint8_t v = (i + j) & 0xff; + if (opt_hdd_flags & HDD_OPT_WR_SEQ) { + /* Write seq has written to all of the file, so it should always be OK */ + if (buf[0] != v) + baddata++; + } else { + /* Write rnd has written to some of the file, so data either zero or OK */ + if (buf[0] != 0 && buf[0] != v) + baddata++; + } + } + } + (*counter)++; } - pr_dbg(stderr, "%s: %" PRIu64 " incomplete reads\n", - name, misreads); + if (misreads) + pr_dbg(stderr, "%s: %" PRIu64 " incomplete random reads\n", + name, misreads); } (void)close(fd); + } while (opt_do_run && (!max_ops || *counter < max_ops)); rc = EXIT_SUCCESS; diff -Nru stress-ng-0.03.19/stress-hsearch.c stress-ng-0.03.20/stress-hsearch.c --- stress-ng-0.03.19/stress-hsearch.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-hsearch.c 2015-02-26 17:18:14.000000000 +0000 @@ -112,10 +112,10 @@ ep = hsearch(e, FIND); if (opt_flags & OPT_FLAGS_VERIFY) { if (ep == NULL) { - pr_fail(stderr, "cannot find key %s\n", keys[i]); + pr_fail(stderr, "%s: cannot find key %s\n", name, keys[i]); } else { if (i != (size_t)ep->data) { - pr_fail(stderr, "hash returned incorrect data %zd\n", i); + pr_fail(stderr, "%s: hash returned incorrect data %zd\n", name, i); } } } diff -Nru stress-ng-0.03.19/stress-inotify.c stress-ng-0.03.20/stress-inotify.c --- stress-ng-0.03.19/stress-inotify.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-inotify.c 2015-02-26 17:18:14.000000000 +0000 @@ -53,8 +53,8 @@ #define TIME_OUT (10) /* Secs for inotify to report back */ #define BUF_SIZE (4096) -typedef int (*inotify_helper)(const char *path, const void *private); -typedef void (*inotify_func)(const char *path); +typedef int (*inotify_helper)(const char *name, const char *path, const void *private); +typedef void (*inotify_func)(const char *name, const char *path); typedef struct { const inotify_func func; @@ -67,6 +67,7 @@ * required inotify event flags 'flags'. */ static void inotify_exercise( + const char *name, /* Stressor name */ const char *filename, /* Filename in test */ const char *watchname, /* File or directory to watch using inotify */ const char *matchname, /* Filename we expect inotify event to report */ @@ -92,19 +93,19 @@ goto retry; } /* Nope, give up */ - pr_fail(stderr, "inotify_init failed: errno=%d (%s) after %" PRIu32 " calls\n", - errno, strerror(errno), n); + pr_fail(stderr, "%s: inotify_init failed: errno=%d (%s) after %" PRIu32 " calls\n", + name, errno, strerror(errno), n); return; } if ((wd = inotify_add_watch(fd, watchname, flags)) < 0) { (void)close(fd); - pr_fail(stderr, "inotify_add_watch failed: errno=%d (%s)", - errno, strerror(errno)); + pr_fail(stderr, "%s: inotify_add_watch failed: errno=%d (%s)", + name, errno, strerror(errno)); return; } - if (func(filename, private) < 0) + if (func(name, filename, private) < 0) goto cleanup; while (check_flags) { @@ -124,12 +125,12 @@ err = select(fd + 1, &rfds, NULL, NULL, &tv); if (err == -1) { if (errno != EINTR) - pr_err(stderr, "select error: errno=%d (%s)\n", - errno, strerror(errno)); + pr_err(stderr, "%s: select error: errno=%d (%s)\n", + name, errno, strerror(errno)); break; } else if (err == 0) { if (opt_flags & OPT_FLAGS_VERIFY) - pr_fail(stderr, "timed waiting for event flags 0x%x\n", flags); + pr_fail(stderr, "%s: timed waiting for event flags 0x%x\n", name, flags); break; } @@ -142,8 +143,8 @@ if ((errno == EAGAIN) || (errno == EINTR)) goto redo; if (errno) { - pr_fail(stderr, "error reading inotify: errno=%d (%s)\n", - errno, strerror(errno)); + pr_fail(stderr, "%s: error reading inotify: errno=%d (%s)\n", + name, errno, strerror(errno)); break; } } @@ -168,8 +169,8 @@ cleanup: (void)inotify_rm_watch(fd, wd); if (close(fd) < 0) { - pr_err(stderr, "close error: errno=%d (%s)\n", - errno, strerror(errno)); + pr_err(stderr, "%s: close error: errno=%d (%s)\n", + name, errno, strerror(errno)); } } @@ -177,11 +178,11 @@ * rm_file() * remove a file */ -static int rm_file(const char *path) +static int rm_file(const char *name, const char *path) { if ((unlink(path) < 0) && errno != ENOENT) { - pr_err(stderr, "cannot remove file %s: errno=%d (%s)\n", - path, errno, strerror(errno)); + pr_err(stderr, "%s: cannot remove file %s: errno=%d (%s)\n", + name, path, errno, strerror(errno)); return -1; } return 0; @@ -191,7 +192,7 @@ * rm_dir() * clean files in directory and directory */ -static int rm_dir(const char *path) +static int rm_dir(const char *name, const char *path) { DIR *dp; int ret; @@ -208,14 +209,14 @@ continue; snprintf(filename, sizeof(filename), "%s/%s", path, d->d_name); - (void)rm_file(filename); + (void)rm_file(name, filename); } (void)closedir(dp); } ret = rmdir(path); if (ret < 0 && errno != ENOENT) - pr_err(stderr, "cannot remove directory %s: errno=%d (%s)\n", - path, errno, strerror(errno)); + pr_err(stderr, "%s: cannot remove directory %s: errno=%d (%s)\n", + name, path, errno, strerror(errno)); return ret; } @@ -223,11 +224,11 @@ * mk_dir() * make a directory */ -static int mk_dir(const char *path) +static int mk_dir(const char *name, const char *path) { if (mkdir(path, DIR_FLAGS) < 0) { - pr_err(stderr, "cannot mkdir %s: errno=%d (%s)\n", - path, errno, strerror(errno)); + pr_err(stderr, "%s: cannot mkdir %s: errno=%d (%s)\n", + name, path, errno, strerror(errno)); return -1; } return 0; @@ -250,17 +251,17 @@ * mk_file() * create file of length len bytes */ -static int mk_file(const char *filename, const size_t len) +static int mk_file(const char *name, const char *filename, const size_t len) { int fd; size_t sz = len; char buffer[BUF_SIZE]; - (void)rm_file(filename); + (void)rm_file(name, filename); if ((fd = open(filename, O_CREAT | O_RDWR, FILE_FLAGS)) < 0) { - pr_err(stderr, "cannot create file %s: errno=%d (%s)\n", - filename, errno, strerror(errno)); + pr_err(stderr, "%s: cannot create file %s: errno=%d (%s)\n", + name, filename, errno, strerror(errno)); return -1; } @@ -270,8 +271,8 @@ int ret; if ((ret = write(fd, buffer, n)) < 0) { - pr_err(stderr, "error writing to file %s: errno=%d (%s)\n", - filename, errno, strerror(errno)); + pr_err(stderr, "%s: error writing to file %s: errno=%d (%s)\n", + name, filename, errno, strerror(errno)); (void)close(fd); return -1; } @@ -279,38 +280,38 @@ } if (close(fd) < 0) { - pr_err(stderr, "cannot close file %s: errno=%d (%s)\n", - filename, errno, strerror(errno)); + pr_err(stderr, "%s: cannot close file %s: errno=%d (%s)\n", + name, filename, errno, strerror(errno)); return -1; } return 0; } -static int inotify_attrib_helper(const char *path, const void *dummy) +static int inotify_attrib_helper(const char *name, const char *path, const void *dummy) { (void)dummy; if (chmod(path, S_IRUSR | S_IWUSR) < 0) { - pr_err(stderr, "cannot chmod file %s: errno=%d (%s)\n", - path, errno, strerror(errno)); + pr_err(stderr, "%s: cannot chmod file %s: errno=%d (%s)\n", + name, path, errno, strerror(errno)); return -1; } return 0; } -void inotify_attrib_file(const char *path) +void inotify_attrib_file(const char *name, const char *path) { char filepath[PATH_MAX]; mk_filename(filepath, PATH_MAX, path, "inotify_file"); - if (mk_file(filepath, 4096) < 0) + if (mk_file(name, filepath, 4096) < 0) return; - inotify_exercise(filepath, path, "inotify_file", inotify_attrib_helper, IN_ATTRIB, NULL); - (void)rm_file(filepath); + inotify_exercise(name, filepath, path, "inotify_file", inotify_attrib_helper, IN_ATTRIB, NULL); + (void)rm_file(name, filepath); } -static int inotify_access_helper(const char *path, const void *dummy) +static int inotify_access_helper(const char *name, const char *path, const void *dummy) { int fd; char buffer[1]; @@ -318,8 +319,8 @@ (void)dummy; if ((fd = open(path, O_RDONLY)) < 0) { - pr_err(stderr, "cannot open file %s: errno=%d (%s)\n", - path, errno, strerror(errno)); + pr_err(stderr, "%s: cannot open file %s: errno=%d (%s)\n", + name, path, errno, strerror(errno)); return -1; } @@ -328,37 +329,37 @@ if (opt_do_run && (read(fd, buffer, 1) < 0)) { if ((errno == EAGAIN) || (errno == EINTR)) goto do_access; - pr_err(stderr, "cannot read file %s: errno=%d (%s)\n", - path, errno, strerror(errno)); + pr_err(stderr, "%s: cannot read file %s: errno=%d (%s)\n", + name, path, errno, strerror(errno)); rc = -1; } (void)close(fd); return rc; } -static void inotify_access_file(const char *path) +static void inotify_access_file(const char *name, const char *path) { char filepath[PATH_MAX]; mk_filename(filepath, PATH_MAX, path, "inotify_file"); - if (mk_file(filepath, 4096) < 0) + if (mk_file(name, filepath, 4096) < 0) return; - inotify_exercise(filepath, path, "inotify_file", inotify_access_helper, IN_ACCESS, NULL); - (void)rm_file(filepath); + inotify_exercise(name, filepath, path, "inotify_file", inotify_access_helper, IN_ACCESS, NULL); + (void)rm_file(name, filepath); } -static int inotify_modify_helper(const char *path, const void *dummy) +static int inotify_modify_helper(const char *name, const char *path, const void *dummy) { int fd, rc = 0; char buffer[1] = { 0 }; (void)dummy; - if (mk_file(path, 4096) < 0) + if (mk_file(name, path, 4096) < 0) return -1; if ((fd = open(path, O_RDWR)) < 0) { - pr_err(stderr, "cannot open file %s: errno=%d (%s)\n", - path, errno, strerror(errno)); + pr_err(stderr, "%s: cannot open file %s: errno=%d (%s)\n", + name, path, errno, strerror(errno)); rc = -1; goto remove; } @@ -366,247 +367,251 @@ if (opt_do_run && (write(fd, buffer, 1) < 0)) { if ((errno == EAGAIN) || (errno == EINTR)) goto do_modify; - pr_err(stderr, "cannot write to file %s: errno=%d (%s)\n", - path, errno, strerror(errno)); + pr_err(stderr, "%s: cannot write to file %s: errno=%d (%s)\n", + name, path, errno, strerror(errno)); rc = -1; } (void)close(fd); remove: - (void)rm_file(path); + (void)rm_file(name, path); return rc; } -static void inotify_modify_file(const char *path) +static void inotify_modify_file(const char *name, const char *path) { char filepath[PATH_MAX]; mk_filename(filepath, PATH_MAX, path, "inotify_file"); - inotify_exercise(filepath, path, "inotify_file", inotify_modify_helper, IN_MODIFY, NULL); + inotify_exercise(name, filepath, path, "inotify_file", inotify_modify_helper, IN_MODIFY, NULL); } -static int inotify_creat_helper(const char *path, const void *dummy) +static int inotify_creat_helper(const char *name, const char *path, const void *dummy) { (void)dummy; int fd; if ((fd = creat(path, FILE_FLAGS)) < 0) { - pr_err(stderr, "cannot create file %s: errno=%d (%s)\n", - path, errno, strerror(errno)); + pr_err(stderr, "%s: cannot create file %s: errno=%d (%s)\n", + name, path, errno, strerror(errno)); return -1; } (void)close(fd); return 0; } -static void inotify_creat_file(const char *path) +static void inotify_creat_file(const char *name, const char *path) { char filepath[PATH_MAX]; mk_filename(filepath, PATH_MAX, path, "inotify_file"); - inotify_exercise(filepath, path, "inotify_file", inotify_creat_helper, IN_CREATE, NULL); - (void)rm_file(filepath); + inotify_exercise(name, filepath, path, "inotify_file", inotify_creat_helper, IN_CREATE, NULL); + (void)rm_file(name, filepath); } -static int inotify_open_helper(const char *path, const void *dummy) +static int inotify_open_helper(const char *name, const char *path, const void *dummy) { int fd; (void)dummy; if ((fd = open(path, O_RDONLY)) < 0) { - pr_err(stderr, "cannot open file %s: errno=%d (%s)\n", - path, errno, strerror(errno)); + pr_err(stderr, "%s: cannot open file %s: errno=%d (%s)\n", + name, path, errno, strerror(errno)); return -1; } (void)close(fd); return 0; } -static void inotify_open_file(const char *path) +static void inotify_open_file(const char *name, const char *path) { char filepath[PATH_MAX]; mk_filename(filepath, PATH_MAX, path, "inotify_file"); - if (mk_file(filepath, 4096) < 0) + if (mk_file(name, filepath, 4096) < 0) return; - inotify_exercise(filepath, path, "inotify_file", inotify_open_helper, IN_OPEN, NULL); - (void)rm_file(filepath); + inotify_exercise(name, filepath, path, "inotify_file", inotify_open_helper, IN_OPEN, NULL); + (void)rm_file(name, filepath); } -static int inotify_delete_helper(const char *path, const void *dummy) +static int inotify_delete_helper(const char *name, const char *path, const void *dummy) { (void)dummy; - return rm_file(path); + return rm_file(name, path); } -static void inotify_delete_file(const char *path) +static void inotify_delete_file(const char *name, const char *path) { char filepath[PATH_MAX]; mk_filename(filepath, PATH_MAX, path, "inotify_file"); - if (mk_file(filepath, 4096) < 0) + if (mk_file(name, filepath, 4096) < 0) return; - inotify_exercise(filepath, path, "inotify_file", inotify_delete_helper, IN_DELETE, NULL); + inotify_exercise(name, filepath, path, "inotify_file", inotify_delete_helper, IN_DELETE, NULL); /* We remove (again) it just in case the test failed */ - (void)rm_file(filepath); + (void)rm_file(name, filepath); } -static int inotify_delete_self_helper(const char *path, const void *dummy) +static int inotify_delete_self_helper(const char *name, const char *path, const void *dummy) { (void)dummy; - return rm_dir(path); + return rm_dir(name, path); } -static void inotify_delete_self(const char *path) +static void inotify_delete_self(const char *name, const char *path) { char filepath[PATH_MAX]; mk_filename(filepath, PATH_MAX, path, "inotify_dir"); - if (mk_dir(filepath) < 0) + if (mk_dir(name, filepath) < 0) return; - inotify_exercise(filepath, filepath, "inotify_dir", inotify_delete_self_helper, IN_DELETE_SELF, NULL); + inotify_exercise(name, filepath, filepath, "inotify_dir", inotify_delete_self_helper, IN_DELETE_SELF, NULL); /* We remove (again) in case the test failed */ - (void)rm_dir(filepath); + (void)rm_dir(name, filepath); } -static int inotify_move_self_helper(const char *oldpath, const void *private) +static int inotify_move_self_helper(const char *name, const char *oldpath, const void *private) { char *newpath = (char*)private; if (rename(oldpath, newpath) < 0) { - pr_err(stderr, "cannot rename %s to %s: errno=%d (%s)\n", - oldpath, newpath, errno, strerror(errno)); + pr_err(stderr, "%s: cannot rename %s to %s: errno=%d (%s)\n", + name, oldpath, newpath, errno, strerror(errno)); return -1; } return 0; } -static void inotify_move_self(const char *path) +static void inotify_move_self(const char *name, const char *path) { char filepath[PATH_MAX], newpath[PATH_MAX]; mk_filename(filepath, PATH_MAX, path, "inotify_dir"); - if (mk_dir(filepath) < 0) + if (mk_dir(name, filepath) < 0) return; mk_filename(newpath, PATH_MAX, path, "renamed_dir"); - inotify_exercise(filepath, filepath, "inotify_dir", inotify_move_self_helper, IN_MOVE_SELF, newpath); - (void)rm_dir(newpath); - (void)rm_dir(filepath); /* In case rename failed */ + inotify_exercise(name, filepath, filepath, "inotify_dir", inotify_move_self_helper, IN_MOVE_SELF, newpath); + (void)rm_dir(name, newpath); + (void)rm_dir(name, filepath); /* In case rename failed */ } -static int inotify_moved_to_helper(const char *newpath, const void *private) +static int inotify_moved_to_helper(const char *name, const char *newpath, const void *private) { char *oldpath = (char*)private; if (rename(oldpath, newpath) < 0) { - pr_err(stderr, "cannot rename %s to %s: errno=%d (%s)\n", - oldpath, newpath, errno, strerror(errno)); + pr_err(stderr, "%s: cannot rename %s to %s: errno=%d (%s)\n", + name, oldpath, newpath, errno, strerror(errno)); return -1; } return 0; } -static void inotify_moved_to(const char *path) +static void inotify_moved_to(const char *name, const char *path) { char olddir[PATH_MAX], oldfile[PATH_MAX], newfile[PATH_MAX]; mk_filename(olddir, PATH_MAX, path, "new_dir"); - (void)rm_dir(olddir); - if (mk_dir(olddir) < 0) + (void)rm_dir(name, olddir); + if (mk_dir(name, olddir) < 0) return; mk_filename(oldfile, PATH_MAX, olddir, "inotify_file"); - if (mk_file(oldfile, 4096) < 0) + if (mk_file(name, oldfile, 4096) < 0) return; mk_filename(newfile, PATH_MAX, path, "inotify_file"); - inotify_exercise(newfile, path, "inotify_dir", inotify_moved_to_helper, IN_MOVED_TO, oldfile); - (void)rm_file(newfile); - (void)rm_dir(olddir); + inotify_exercise(name, newfile, path, "inotify_dir", inotify_moved_to_helper, IN_MOVED_TO, oldfile); + (void)rm_file(name, newfile); + (void)rm_dir(name, olddir); } -static int inotify_moved_from_helper(const char *oldpath, const void *private) +static int inotify_moved_from_helper(const char *name, const char *oldpath, const void *private) { char *newpath = (char*)private; if (rename(oldpath, newpath) < 0) { - pr_err(stderr, "cannot rename %s to %s: errno=%d (%s)\n", - oldpath, newpath, errno, strerror(errno)); + pr_err(stderr, "%s: cannot rename %s to %s: errno=%d (%s)\n", + name, oldpath, newpath, errno, strerror(errno)); return -1; } return 0; } -static void inotify_moved_from(const char *path) +static void inotify_moved_from(const char *name, const char *path) { char oldfile[PATH_MAX], newdir[PATH_MAX], newfile[PATH_MAX]; mk_filename(oldfile, PATH_MAX, path, "inotify_file"); - if (mk_file(oldfile, 4096) < 0) + if (mk_file(name, oldfile, 4096) < 0) return; mk_filename(newdir, PATH_MAX, path, "new_dir"); - (void)rm_dir(newdir); - if (mk_dir(newdir) < 0) + (void)rm_dir(name, newdir); + if (mk_dir(name, newdir) < 0) return; mk_filename(newfile, PATH_MAX, newdir, "inotify_file"); - inotify_exercise(oldfile, path, "inotify_dir", inotify_moved_from_helper, IN_MOVED_FROM, newfile); - (void)rm_file(newfile); - (void)rm_file(oldfile); /* In case rename failed */ - (void)rm_dir(newdir); + inotify_exercise(name, oldfile, path, "inotify_dir", inotify_moved_from_helper, IN_MOVED_FROM, newfile); + (void)rm_file(name, newfile); + (void)rm_file(name, oldfile); /* In case rename failed */ + (void)rm_dir(name, newdir); } -static int inotify_close_write_helper(const char *path, const void *fdptr) +static int inotify_close_write_helper(const char *name, const char *path, const void *fdptr) { + (void)name; (void)path; + (void)close(*(int *)fdptr); return 0; } -static void inotify_close_write_file(const char *path) +static void inotify_close_write_file(const char *name, const char *path) { char filepath[PATH_MAX]; int fd; mk_filename(filepath, PATH_MAX, path, "inotify_file"); - if (mk_file(filepath, 4096) < 0) + if (mk_file(name, filepath, 4096) < 0) return; if ((fd = open(filepath, O_RDWR)) < 0) { - pr_err(stderr, "cannot re-open %s: errno=%d (%s)\n", - filepath, errno, strerror(errno)); + pr_err(stderr, "%s: cannot re-open %s: errno=%d (%s)\n", + name, filepath, errno, strerror(errno)); return; } - inotify_exercise(filepath, path, "inotify_file", inotify_close_write_helper, IN_CLOSE_WRITE, (void*)&fd); - (void)rm_file(filepath); + inotify_exercise(name, filepath, path, "inotify_file", inotify_close_write_helper, IN_CLOSE_WRITE, (void*)&fd); + (void)rm_file(name, filepath); (void)close(fd); } -static int inotify_close_nowrite_helper(const char *path, const void *fdptr) +static int inotify_close_nowrite_helper(const char *name, const char *path, const void *fdptr) { + (void)name; (void)path; + (void)close(*(int *)fdptr); return 0; } -static void inotify_close_nowrite_file(const char *path) +static void inotify_close_nowrite_file(const char *name, const char *path) { char filepath[PATH_MAX]; int fd; mk_filename(filepath, PATH_MAX, path, "inotify_file"); - if (mk_file(filepath, 4096) < 0) + if (mk_file(name, filepath, 4096) < 0) return; if ((fd = open(filepath, O_RDONLY)) < 0) { - pr_err(stderr, "cannot re-open %s: errno=%d (%s)\n", - filepath, errno, strerror(errno)); - (void)rm_file(filepath); + pr_err(stderr, "%s: cannot re-open %s: errno=%d (%s)\n", + name, filepath, errno, strerror(errno)); + (void)rm_file(name, filepath); return; } - inotify_exercise(filepath, path, "inotify_file", inotify_close_nowrite_helper, IN_CLOSE_NOWRITE, (void*)&fd); - (void)rm_file(filepath); + inotify_exercise(name, filepath, path, "inotify_file", inotify_close_nowrite_helper, IN_CLOSE_NOWRITE, (void*)&fd); + (void)rm_file(name, filepath); (void)close(fd); } @@ -648,7 +653,7 @@ return EXIT_FAILURE; do { for (i = 0; opt_do_run && inotify_stressors[i].func; i++) - inotify_stressors[i].func(dirname); + inotify_stressors[i].func(name, dirname); (*counter)++; } while (opt_do_run && (!max_ops || *counter < max_ops)); (void)stress_temp_dir_rm(name, pid, instance); diff -Nru stress-ng-0.03.19/stress-kcmp.c stress-ng-0.03.20/stress-kcmp.c --- stress-ng-0.03.19/stress-kcmp.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-kcmp.c 2015-02-26 17:18:14.000000000 +0000 @@ -85,9 +85,9 @@ if (rc < 0) { \ pr_failed_err(name, "kcmp: " # type);\ } else { \ - pr_fail(stderr, "kcmp " # type \ + pr_fail(stderr, "%s: kcmp " # type \ " returned %d, expected: %d\n", \ - rc, ret); \ + name, rc, ret); \ } \ } \ } diff -Nru stress-ng-0.03.19/stress-kill.c stress-ng-0.03.20/stress-kill.c --- stress-ng-0.03.19/stress-kill.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-kill.c 2015-02-26 17:18:14.000000000 +0000 @@ -64,8 +64,8 @@ ret = kill(pid, SIGUSR1); if ((ret < 0) && (opt_flags & OPT_FLAGS_VERIFY)) - pr_fail(stderr, "kill failed: errno=%d (%s)\n", - errno, strerror(errno)); + pr_fail(stderr, "%s: kill failed: errno=%d (%s)\n", + name, errno, strerror(errno)); (*counter)++; } while (opt_do_run && (!max_ops || *counter < max_ops)); diff -Nru stress-ng-0.03.19/stress-lsearch.c stress-ng-0.03.20/stress-lsearch.c --- stress-ng-0.03.19/stress-lsearch.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-lsearch.c 2015-02-26 17:18:14.000000000 +0000 @@ -103,10 +103,10 @@ result = lfind(&data[i], root, &n, sizeof(int32_t), cmp); if (opt_flags & OPT_FLAGS_VERIFY) { if (result == NULL) - pr_fail(stderr, "element %zu could not be found\n", i); + pr_fail(stderr, "%s: element %zu could not be found\n", name, i); else if (*result != data[i]) - pr_fail(stderr, "element %zu found %" PRIu32 ", expecting %" PRIu32 "\n", - i, *result, data[i]); + pr_fail(stderr, "%s: element %zu found %" PRIu32 ", expecting %" PRIu32 "\n", + name, i, *result, data[i]); } } (*counter)++; diff -Nru stress-ng-0.03.19/stress-mmap.c stress-ng-0.03.20/stress-mmap.c --- stress-ng-0.03.19/stress-mmap.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-mmap.c 2015-02-26 17:18:14.000000000 +0000 @@ -87,20 +87,20 @@ * stress_mmap_mprotect() * cycle through page settings on a region of mmap'd memory */ -static void stress_mmap_mprotect(void *addr, size_t len) +static void stress_mmap_mprotect(const char *name, void *addr, const size_t len) { if (opt_flags & OPT_FLAGS_MMAP_MPROTECT) { /* Cycle through potection */ if (mprotect(addr, len, PROT_NONE) < 0) - pr_fail(stderr, "mprotect set to PROT_NONE failed\n"); + pr_fail(stderr, "%s: mprotect set to PROT_NONE failed\n", name); if (mprotect(addr, len, PROT_READ) < 0) - pr_fail(stderr, "mprotect set to PROT_READ failed\n"); + pr_fail(stderr, "%s: mprotect set to PROT_READ failed\n", name); if (mprotect(addr, len, PROT_WRITE) < 0) - pr_fail(stderr, "mprotect set to PROT_WRITE failed\n"); + pr_fail(stderr, "%s: mprotect set to PROT_WRITE failed\n", name); if (mprotect(addr, len, PROT_EXEC) < 0) - pr_fail(stderr, "mprotect set to PROT_EXEC failed\n"); + pr_fail(stderr, "%s: mprotect set to PROT_EXEC failed\n", name); if (mprotect(addr, len, PROT_READ | PROT_WRITE) < 0) - pr_fail(stderr, "mprotect set to PROT_READ | PROT_WRITE failed\n"); + pr_fail(stderr, "%s: mprotect set to PROT_READ | PROT_WRITE failed\n", name); } } @@ -206,7 +206,7 @@ } (void)madvise_random(buf, sz); (void)mincore_touch_pages(buf, opt_mmap_bytes); - stress_mmap_mprotect(buf, sz); + stress_mmap_mprotect(name, buf, sz); memset(mapped, PAGE_MAPPED, sizeof(mapped)); for (n = 0; n < pages4k; n++) mappings[n] = buf + (n * page_size); @@ -215,8 +215,8 @@ stress_mmap_set(buf, sz); if (opt_flags & OPT_FLAGS_VERIFY) { if (stress_mmap_check(buf, sz) < 0) - pr_fail(stderr, "mmap'd region of %zu bytes does " - "not contain expected data\n", sz); + pr_fail(stderr, "%s: mmap'd region of %zu bytes does " + "not contain expected data\n", name, sz); } /* @@ -230,7 +230,7 @@ if (mapped[page] == PAGE_MAPPED) { mapped[page] = 0; (void)madvise_random(mappings[page], page_size); - stress_mmap_mprotect(mappings[page], page_size); + stress_mmap_mprotect(name, mappings[page], page_size); munmap(mappings[page], page_size); n--; break; @@ -263,13 +263,13 @@ } else { (void)mincore_touch_pages(buf, page_size); (void)madvise_random(mappings[page], page_size); - stress_mmap_mprotect(mappings[page], page_size); + stress_mmap_mprotect(name, mappings[page], page_size); mapped[page] = PAGE_MAPPED; /* Ensure we can write to the mapped page */ stress_mmap_set(mappings[page], page_size); if (stress_mmap_check(mappings[page], page_size) < 0) - pr_fail(stderr, "mmap'd region of %zu bytes does " - "not contain expected data\n", page_size); + pr_fail(stderr, "%s: mmap'd region of %zu bytes does " + "not contain expected data\n", name, page_size); if (opt_flags & OPT_FLAGS_MMAP_FILE) { memset(mappings[page], n, page_size); #if !defined(__gnu_hurd__) @@ -292,7 +292,7 @@ for (n = 0; n < pages4k; n++) { if (mapped[n] & PAGE_MAPPED) { (void)madvise_random(mappings[n], page_size); - stress_mmap_mprotect(mappings[n], page_size); + stress_mmap_mprotect(name, mappings[n], page_size); munmap(mappings[n], page_size); } } diff -Nru stress-ng-0.03.19/stress-mq.c stress-ng-0.03.20/stress-mq.c --- stress-ng-0.03.19/stress-mq.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-mq.c 2015-02-26 17:18:14.000000000 +0000 @@ -124,7 +124,7 @@ return EXIT_FAILURE; } if (sz < opt_mq_size) { - pr_inf(stdout, "POSIX message queue requested size %d messages, maximum of %d allowed\n", opt_mq_size, sz); + pr_inf(stdout, "%s: POSIX message queue requested size %d messages, maximum of %d allowed\n", name, opt_mq_size, sz); } pr_dbg(stderr, "POSIX message queue %s with %lu messages\n", mq_name, (unsigned long)attr.mq_maxmsg); @@ -148,10 +148,10 @@ break; if (opt_flags & OPT_FLAGS_VERIFY) { if (msg.value != i) { - pr_fail(stderr, "mq_receive: expected message " + pr_fail(stderr, "%s: mq_receive: expected message " "containing 0x%" PRIx64 " but received 0x%" PRIx64 " instead\n", - i, msg.value); + name, i, msg.value); } } } diff -Nru stress-ng-0.03.19/stress-mremap.c stress-ng-0.03.20/stress-mremap.c --- stress-ng-0.03.19/stress-mremap.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-mremap.c 2015-02-26 17:18:14.000000000 +0000 @@ -179,8 +179,8 @@ if (opt_flags & OPT_FLAGS_VERIFY) { stress_mremap_set(buf, new_sz); if (stress_mremap_check(buf, sz) < 0) { - pr_fail(stderr, "mmap'd region of %zu bytes does " - "not contain expected data\n", sz); + pr_fail(stderr, "%s: mmap'd region of %zu bytes does " + "not contain expected data\n", name, sz); munmap(buf, new_sz); return EXIT_FAILURE; } @@ -196,8 +196,8 @@ (void)madvise_random(buf, new_sz); if (opt_flags & OPT_FLAGS_VERIFY) { if (stress_mremap_check(buf, new_sz) < 0) { - pr_fail(stderr, "mremap'd region of %zu bytes does " - "not contain expected data\n", sz); + pr_fail(stderr, "%s: mremap'd region of %zu bytes does " + "not contain expected data\n", name, sz); munmap(buf, new_sz); return EXIT_FAILURE; } diff -Nru stress-ng-0.03.19/stress-msg.c stress-ng-0.03.20/stress-msg.c --- stress-ng-0.03.19/stress-msg.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-msg.c 2015-02-26 17:18:14.000000000 +0000 @@ -92,8 +92,8 @@ if (opt_flags & OPT_FLAGS_VERIFY) { memcpy(&v, msg.msg, sizeof(v)); if (v != i) - pr_fail(stderr, "msgrcv: expected msg containing 0x%" PRIx64 - " but received 0x%" PRIx64 " instead\n", i, v); + pr_fail(stderr, "%s: msgrcv: expected msg containing 0x%" PRIx64 + " but received 0x%" PRIx64 " instead\n", name, i, v); } } exit(EXIT_SUCCESS); diff -Nru stress-ng-0.03.19/stress-ng.1 stress-ng-0.03.20/stress-ng.1 --- stress-ng-0.03.19/stress-ng.1 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-ng.1 2015-02-26 17:18:14.000000000 +0000 @@ -498,7 +498,7 @@ stop get stressors after N bogo get operations. .TP .B \-d N, \-\-hdd N -start N processes continually writing and removing temporary files. +start N processes continually writing, reading and removing temporary files. .TP .B \-\-hdd\-bytes N write N bytes for each hdd process, the default is 1 GB. One can specify the size in units of Bytes, KBytes, MBytes and GBytes using the suffix b, k, m or g. diff -Nru stress-ng-0.03.19/stress-ng.c stress-ng-0.03.20/stress-ng.c --- stress-ng-0.03.19/stress-ng.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-ng.c 2015-02-26 17:18:14.000000000 +0000 @@ -1323,7 +1323,7 @@ len += buffer_len; } } - pr_inf(stdout, "dispatching hogs: %s\n", str ? str : ""); + pr_inf(stdout, "dispatching hogs:%s\n", str ? str : ""); free(str); fflush(stdout); diff -Nru stress-ng-0.03.19/stress-ng.h stress-ng-0.03.20/stress-ng.h --- stress-ng-0.03.19/stress-ng.h 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-ng.h 2015-02-26 17:18:14.000000000 +0000 @@ -102,6 +102,7 @@ #define OPT_FLAGS_MAXIMIZE 0x0100000000ULL /* Maximize */ #define OPT_FLAGS_MINMAX_MASK (OPT_FLAGS_MINIMIZE | OPT_FLAGS_MAXIMIZE) #define OPT_FLAGS_SYSLOG 0x0200000000ULL /* log test progress to syslog */ +#define OPT_FLAGS_AGGRESSIVE 0x0400000000ULL /* aggressive mode enabled */ #define OPT_FLAGS_AGGRESSIVE_MASK \ (OPT_FLAGS_AFFINITY_RAND | OPT_FLAGS_UTIME_FSYNC | \ @@ -111,7 +112,8 @@ OPT_FLAGS_MMAP_MPROTECT | OPT_FLAGS_LOCKF_NONBLK |\ OPT_FLAGS_MINCORE_RAND | OPT_FLAGS_HDD_SYNC | \ OPT_FLAGS_HDD_DSYNC | OPT_FLAGS_HDD_DIRECT | \ - OPT_FLAGS_STACK_FILL | OPT_FLAGS_CACHE_PREFETCH) + OPT_FLAGS_STACK_FILL | OPT_FLAGS_CACHE_PREFETCH | \ + OPT_FLAGS_AGGRESSIVE) /* Stressor classes */ diff -Nru stress-ng-0.03.19/stress-pipe.c stress-ng-0.03.20/stress-pipe.c --- stress-ng-0.03.19/stress-pipe.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-pipe.c 2015-02-26 17:18:14.000000000 +0000 @@ -109,7 +109,7 @@ break; if ((opt_flags & OPT_FLAGS_VERIFY) && pipe_memchk(buf, val++, (size_t)n)) { - pr_fail(stderr, "pipe read error detected, failed to read expected data\n"); + pr_fail(stderr, "%s: pipe read error detected, failed to read expected data\n", name); } } (void)close(pipefds[0]); diff -Nru stress-ng-0.03.19/stress-poll.c stress-ng-0.03.20/stress-poll.c --- stress-ng-0.03.19/stress-poll.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-poll.c 2015-02-26 17:18:14.000000000 +0000 @@ -43,7 +43,7 @@ * pipe_read() * read a pipe with some verification and checking */ -static int pipe_read(int fd, int n) +static int pipe_read(const char *name, const int fd, const int n) { char buf[POLL_BUF]; ssize_t ret; @@ -56,7 +56,7 @@ if (ret < 0) { if ((errno == EAGAIN) || (errno == EINTR)) goto redo; - pr_fail(stderr, "pipe read error detected\n"); + pr_fail(stderr, "%s: pipe read error detected\n", name); return ret; } if (ret > 0) { @@ -64,7 +64,7 @@ for (i = 0; i < ret; i++) { if (buf[i] != '0' + n) { - pr_fail(stderr, "pipe read error, expecting different data on pipe\n"); + pr_fail(stderr, "%s: pipe read error, expecting different data on pipe\n", name); return ret; } } @@ -160,13 +160,13 @@ ret = poll(fds, MAX_PIPES, 1); if ((opt_flags & OPT_FLAGS_VERIFY) && (ret < 0) && (errno != EINTR)) { - pr_fail(stderr, "poll failed with error: %d (%s)\n", - errno, strerror(errno)); + pr_fail(stderr, "%s: poll failed with error: %d (%s)\n", + name, errno, strerror(errno)); } if (ret > 0) { for (i = 0; i < MAX_PIPES; i++) { if (fds[i].revents == POLLIN) { - if (pipe_read(fds[i].fd, i) < 0) + if (pipe_read(name, fds[i].fd, i) < 0) break; } } @@ -181,13 +181,13 @@ ret = select(maxfd + 1, &rfds, NULL, NULL, &tv); if ((opt_flags & OPT_FLAGS_VERIFY) && (ret < 0) && (errno != EINTR)) { - pr_fail(stderr, "select failed with error: %d (%s)\n", - errno, strerror(errno)); + pr_fail(stderr, "%s: select failed with error: %d (%s)\n", + name, errno, strerror(errno)); } if (ret > 0) { for (i = 0; i < MAX_PIPES; i++) { if (FD_ISSET(pipefds[i][0], &rfds)) { - if (pipe_read(pipefds[i][0], i) < 0) + if (pipe_read(name, pipefds[i][0], i) < 0) break; } FD_SET(pipefds[i][0], &rfds); diff -Nru stress-ng-0.03.19/stress-pthread.c stress-ng-0.03.20/stress-pthread.c --- stress-ng-0.03.19/stress-pthread.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-pthread.c 2015-02-26 17:18:14.000000000 +0000 @@ -237,9 +237,10 @@ } while (ok && opt_do_run && (!max_ops || *counter < max_ops)); if (limited) { - pr_inf(stdout, "%.2f%% of iterations could not reach " + pr_inf(stdout, "%s: %.2f%% of iterations could not reach " "requested %" PRIu64 " threads (instance %" PRIu32 ")\n", + name, 100.0 * (double)limited / (double)attempted, opt_pthread_max, instance); } diff -Nru stress-ng-0.03.19/stress-qsort.c stress-ng-0.03.20/stress-qsort.c --- stress-ng-0.03.19/stress-qsort.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-qsort.c 2015-02-26 17:18:14.000000000 +0000 @@ -118,7 +118,7 @@ if (opt_flags & OPT_FLAGS_VERIFY) { for (ptr = data, i = 0; i < n - 1; i++, ptr++) { if (*ptr > *(ptr+1)) { - pr_fail(stderr, "sort error detected, incorrect ordering found\n"); + pr_fail(stderr, "%s: sort error detected, incorrect ordering found\n", name); break; } } @@ -131,7 +131,7 @@ if (opt_flags & OPT_FLAGS_VERIFY) { for (ptr = data, i = 0; i < n - 1; i++, ptr++) { if (*ptr < *(ptr+1)) { - pr_fail(stderr, "reverse sort error detected, incorrect ordering found\n"); + pr_fail(stderr, "%s: reverse sort error detected, incorrect ordering found\n", name); break; } } @@ -146,7 +146,7 @@ if (opt_flags & OPT_FLAGS_VERIFY) { for (ptr = data, i = 0; i < n - 1; i++, ptr++) { if (*ptr < *(ptr+1)) { - pr_fail(stderr, "reverse sort error detected, incorrect ordering found\n"); + pr_fail(stderr, "%s: reverse sort error detected, incorrect ordering found\n", name); break; } } diff -Nru stress-ng-0.03.19/stress-seek.c stress-ng-0.03.20/stress-seek.c --- stress-ng-0.03.19/stress-seek.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-seek.c 2015-02-26 17:18:14.000000000 +0000 @@ -135,7 +135,7 @@ } if ((ret != sizeof(tmp)) && (opt_flags & OPT_FLAGS_VERIFY)) { - pr_fail(stderr, "incorrect read size, expecting 512 bytes"); + pr_fail(stderr, "%s: incorrect read size, expecting 512 bytes", name); } (*counter)++; } while (opt_do_run && (!max_ops || *counter < max_ops)); diff -Nru stress-ng-0.03.19/stress-tsearch.c stress-ng-0.03.20/stress-tsearch.c --- stress-ng-0.03.19/stress-tsearch.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-tsearch.c 2015-02-26 17:18:14.000000000 +0000 @@ -100,7 +100,7 @@ if (tsearch(&data[i], &root, cmp) == NULL) { size_t j; - pr_err(stderr, "cannot allocate new tree node\n"); + pr_err(stderr, "%s: cannot allocate new tree node\n", name); for (j = 0; j < i; j++) tdelete(&data[j], &root, cmp); goto abort; @@ -113,13 +113,13 @@ result = tfind(&data[i], &root, cmp); if (opt_flags & OPT_FLAGS_VERIFY) { if (result == NULL) - pr_fail(stderr, "element %zu could not be found\n", i); + pr_fail(stderr, "%s: element %zu could not be found\n", name, i); else { int32_t *val; val = *result; if (*val != data[i]) - pr_fail(stderr, "element %zu found %" PRIu32 ", expecting %" PRIu32 "\n", - i, *val, data[i]); + pr_fail(stderr, "%s: element %zu found %" PRIu32 ", expecting %" PRIu32 "\n", + name, i, *val, data[i]); } } } @@ -129,7 +129,7 @@ result = tdelete(&data[i], &root, cmp); if ((opt_flags & OPT_FLAGS_VERIFY) && (result == NULL)) - pr_fail(stderr, "element %zu could not be found\n", i); + pr_fail(stderr, "%s: element %zu could not be found\n", name, i); } (*counter)++; } while (opt_do_run && (!max_ops || *counter < max_ops)); diff -Nru stress-ng-0.03.19/stress-wait.c stress-ng-0.03.20/stress-wait.c --- stress-ng-0.03.19/stress-wait.c 2015-02-23 15:59:20.000000000 +0000 +++ stress-ng-0.03.20/stress-wait.c 2015-02-26 17:18:14.000000000 +0000 @@ -45,7 +45,8 @@ * spawn a process */ static int spawn( - void (*func)(const pid_t pid, uint64_t *counter, const uint64_t max_ops), + const char *name, + void (*func)(const char *name, const pid_t pid, uint64_t *counter, const uint64_t max_ops), pid_t pid_arg, uint64_t *counter, uint64_t max_ops) @@ -57,7 +58,7 @@ return -1; } if (pid == 0) { - func(pid_arg, counter, max_ops); + func(name, pid_arg, counter, max_ops); exit(EXIT_SUCCESS); } return pid; @@ -68,11 +69,11 @@ * this process pauses, but is continually being * stopped and continued by the killer process */ -static void runner(const pid_t pid, uint64_t *counter, const uint64_t max_ops) +static void runner(const char *name, const pid_t pid, uint64_t *counter, const uint64_t max_ops) { (void)pid; - pr_dbg(stderr, "wait: runner started [%d]\n", getpid()); + pr_dbg(stderr, "%s: wait: runner started [%d]\n", name, getpid()); do { (void)pause(); @@ -86,12 +87,12 @@ * killer() * this continually stops and continues the runner process */ -static void killer(const pid_t pid, uint64_t *counter, const uint64_t max_ops) +static void killer(const char *name, const pid_t pid, uint64_t *counter, const uint64_t max_ops) { double start = time_now(); uint64_t last_counter = *counter; - pr_dbg(stderr, "wait: killer started [%d]\n", getpid()); + pr_dbg(stderr, "%s: wait: killer started [%d]\n", name, getpid()); do { (void)kill(pid, SIGSTOP); @@ -106,7 +107,7 @@ */ if (last_counter == *counter) { if (time_now() - start > ABORT_TIMEOUT) { - pr_dbg(stderr, "waits were blocked, aborting\n"); + pr_dbg(stderr, "%s: waits were blocked, aborting\n", name); break; } } else { @@ -140,13 +141,13 @@ pr_dbg(stderr, "%s: waiter started [%d]\n", name, getpid()); - pid_r = spawn(runner, 0, counter, max_ops); + pid_r = spawn(name, runner, 0, counter, max_ops); if (pid_r < 0) { pr_failed_dbg(name, "fork"); exit(EXIT_FAILURE); } - pid_k = spawn(killer, pid_r, counter, max_ops); + pid_k = spawn(name, killer, pid_r, counter, max_ops); if (pid_k < 0) { pr_failed_dbg(name, "fork"); ret = EXIT_FAILURE; diff -Nru stress-ng-0.03.19/stress-yield.c stress-ng-0.03.20/stress-yield.c --- stress-ng-0.03.19/stress-yield.c 2015-02-17 18:29:01.000000000 +0000 +++ stress-ng-0.03.20/stress-yield.c 2015-02-26 17:18:14.000000000 +0000 @@ -52,8 +52,8 @@ ret = sched_yield(); if ((ret < 0) && (opt_flags & OPT_FLAGS_VERIFY)) - pr_fail(stderr, "sched_yield failed: errno=%d (%s)\n", - errno, strerror(errno)); + pr_fail(stderr, "%s: sched_yield failed: errno=%d (%s)\n", + name, errno, strerror(errno)); (*counter)++; } while (opt_do_run && (!max_ops || *counter < max_ops));