diff options
| author | John Stultz <john.stultz@linaro.org> | 2015-03-11 20:39:58 -0400 |
|---|---|---|
| committer | Shuah Khan <shuahkh@osg.samsung.com> | 2015-03-12 15:22:12 -0400 |
| commit | 2430ec652dd67243484c90fe34a4433622fc2a30 (patch) | |
| tree | 5ed2cae69531e7e905d98bbc9d04eb044132a05e /tools/testing | |
| parent | 03438212d0b0ea2cf201e921c9056f683c624ffb (diff) | |
selftests/timers: Quiet warning due to lack of return check on brk
The posix_timers.c test has a loop that tries to keep it in
kernel space, repeatedly calling brk(). However, it doesn't
check the return value, which causes warnings.
This patch adds a err value which captures the return value
and modifies the test so it will quit if a failure occurs.
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Tested-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Diffstat (limited to 'tools/testing')
| -rw-r--r-- | tools/testing/selftests/timers/posix_timers.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/testing/selftests/timers/posix_timers.c b/tools/testing/selftests/timers/posix_timers.c index f87d970a485c..5a246a02dff3 100644 --- a/tools/testing/selftests/timers/posix_timers.c +++ b/tools/testing/selftests/timers/posix_timers.c | |||
| @@ -35,10 +35,11 @@ static void user_loop(void) | |||
| 35 | static void kernel_loop(void) | 35 | static void kernel_loop(void) |
| 36 | { | 36 | { |
| 37 | void *addr = sbrk(0); | 37 | void *addr = sbrk(0); |
| 38 | int err = 0; | ||
| 38 | 39 | ||
| 39 | while (!done) { | 40 | while (!done && !err) { |
| 40 | brk(addr + 4096); | 41 | err = brk(addr + 4096); |
| 41 | brk(addr); | 42 | err |= brk(addr); |
| 42 | } | 43 | } |
| 43 | } | 44 | } |
| 44 | 45 | ||
| @@ -190,8 +191,6 @@ static int check_timer_create(int which) | |||
| 190 | 191 | ||
| 191 | int main(int argc, char **argv) | 192 | int main(int argc, char **argv) |
| 192 | { | 193 | { |
| 193 | int err; | ||
| 194 | |||
| 195 | printf("Testing posix timers. False negative may happen on CPU execution \n"); | 194 | printf("Testing posix timers. False negative may happen on CPU execution \n"); |
| 196 | printf("based timers if other threads run on the CPU...\n"); | 195 | printf("based timers if other threads run on the CPU...\n"); |
| 197 | 196 | ||
