diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-04 20:32:24 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-04 20:32:24 -0400 |
| commit | 2521129a6d2fd8a81f99cf95055eddea3df914ff (patch) | |
| tree | f8b7879979f656669ce31cbc247b97ae702291fb /tools/testing/selftests/mqueue | |
| parent | 98a96f202203fecad65b44449077c695686ad4db (diff) | |
| parent | 16eb2bfc65ef86d3ac6420d50ddc2c48f0023cee (diff) | |
Merge tag 'char-misc-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char / misc driver patches from Greg KH:
"Here's the big driver misc / char pull request for 3.17-rc1.
Lots of things in here, the thunderbolt support for Apple laptops,
some other new drivers, testing fixes, and other good things. All
have been in linux-next for a long time"
* tag 'char-misc-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (119 commits)
misc: bh1780: Introduce the use of devm_kzalloc
Lattice ECP3 FPGA: Correct endianness
drivers/misc/ti-st: Load firmware from ti-connectivity directory.
dt-bindings: extcon: Add support for SM5502 MUIC device
extcon: sm5502: Change internal hardware switch according to cable type
extcon: sm5502: Detect cable state after completing platform booting
extcon: sm5502: Add support new SM5502 extcon device driver
extcon: arizona: Get MICVDD against extcon device
extcon: Remove unnecessary OOM messages
misc: vexpress: Fix sparse non static symbol warnings
mei: drop unused hw dependent fw status functions
misc: bh1770glc: Use managed functions
pcmcia: remove DEFINE_PCI_DEVICE_TABLE usage
misc: remove DEFINE_PCI_DEVICE_TABLE usage
ipack: Replace DEFINE_PCI_DEVICE_TABLE macro use
drivers/char/dsp56k.c: drop check for negativity of unsigned parameter
mei: fix return value on disconnect timeout
mei: don't schedule suspend in pm idle
mei: start disconnect request timer consistently
mei: reset client connection state on timeout
...
Diffstat (limited to 'tools/testing/selftests/mqueue')
| -rw-r--r-- | tools/testing/selftests/mqueue/Makefile | 4 | ||||
| -rw-r--r-- | tools/testing/selftests/mqueue/mq_open_tests.c | 20 | ||||
| -rw-r--r-- | tools/testing/selftests/mqueue/mq_perf_tests.c | 40 |
3 files changed, 37 insertions, 27 deletions
diff --git a/tools/testing/selftests/mqueue/Makefile b/tools/testing/selftests/mqueue/Makefile index 218a122c7951..8056e2e68fa4 100644 --- a/tools/testing/selftests/mqueue/Makefile +++ b/tools/testing/selftests/mqueue/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | all: | 1 | all: |
| 2 | gcc -O2 -lrt mq_open_tests.c -o mq_open_tests | 2 | gcc -O2 mq_open_tests.c -o mq_open_tests -lrt |
| 3 | gcc -O2 -lrt -lpthread -lpopt -o mq_perf_tests mq_perf_tests.c | 3 | gcc -O2 -o mq_perf_tests mq_perf_tests.c -lrt -lpthread -lpopt |
| 4 | 4 | ||
| 5 | run_tests: | 5 | run_tests: |
| 6 | @./mq_open_tests /test1 || echo "mq_open_tests: [FAIL]" | 6 | @./mq_open_tests /test1 || echo "mq_open_tests: [FAIL]" |
diff --git a/tools/testing/selftests/mqueue/mq_open_tests.c b/tools/testing/selftests/mqueue/mq_open_tests.c index 711cc2923047..9c1a5d359055 100644 --- a/tools/testing/selftests/mqueue/mq_open_tests.c +++ b/tools/testing/selftests/mqueue/mq_open_tests.c | |||
| @@ -80,7 +80,8 @@ void shutdown(int exit_val, char *err_cause, int line_no) | |||
| 80 | if (in_shutdown++) | 80 | if (in_shutdown++) |
| 81 | return; | 81 | return; |
| 82 | 82 | ||
| 83 | seteuid(0); | 83 | if (seteuid(0) == -1) |
| 84 | perror("seteuid() failed"); | ||
| 84 | 85 | ||
| 85 | if (queue != -1) | 86 | if (queue != -1) |
| 86 | if (mq_close(queue)) | 87 | if (mq_close(queue)) |
| @@ -292,8 +293,10 @@ int main(int argc, char *argv[]) | |||
| 292 | /* Tell the user our initial state */ | 293 | /* Tell the user our initial state */ |
| 293 | printf("\nInitial system state:\n"); | 294 | printf("\nInitial system state:\n"); |
| 294 | printf("\tUsing queue path:\t\t%s\n", queue_path); | 295 | printf("\tUsing queue path:\t\t%s\n", queue_path); |
| 295 | printf("\tRLIMIT_MSGQUEUE(soft):\t\t%d\n", saved_limits.rlim_cur); | 296 | printf("\tRLIMIT_MSGQUEUE(soft):\t\t%ld\n", |
| 296 | printf("\tRLIMIT_MSGQUEUE(hard):\t\t%d\n", saved_limits.rlim_max); | 297 | (long) saved_limits.rlim_cur); |
| 298 | printf("\tRLIMIT_MSGQUEUE(hard):\t\t%ld\n", | ||
| 299 | (long) saved_limits.rlim_max); | ||
| 297 | printf("\tMaximum Message Size:\t\t%d\n", saved_max_msgsize); | 300 | printf("\tMaximum Message Size:\t\t%d\n", saved_max_msgsize); |
| 298 | printf("\tMaximum Queue Size:\t\t%d\n", saved_max_msgs); | 301 | printf("\tMaximum Queue Size:\t\t%d\n", saved_max_msgs); |
| 299 | if (default_settings) { | 302 | if (default_settings) { |
| @@ -308,8 +311,8 @@ int main(int argc, char *argv[]) | |||
| 308 | validate_current_settings(); | 311 | validate_current_settings(); |
| 309 | 312 | ||
| 310 | printf("Adjusted system state for testing:\n"); | 313 | printf("Adjusted system state for testing:\n"); |
| 311 | printf("\tRLIMIT_MSGQUEUE(soft):\t\t%d\n", cur_limits.rlim_cur); | 314 | printf("\tRLIMIT_MSGQUEUE(soft):\t\t%ld\n", (long) cur_limits.rlim_cur); |
| 312 | printf("\tRLIMIT_MSGQUEUE(hard):\t\t%d\n", cur_limits.rlim_max); | 315 | printf("\tRLIMIT_MSGQUEUE(hard):\t\t%ld\n", (long) cur_limits.rlim_max); |
| 313 | printf("\tMaximum Message Size:\t\t%d\n", cur_max_msgsize); | 316 | printf("\tMaximum Message Size:\t\t%d\n", cur_max_msgsize); |
| 314 | printf("\tMaximum Queue Size:\t\t%d\n", cur_max_msgs); | 317 | printf("\tMaximum Queue Size:\t\t%d\n", cur_max_msgs); |
| 315 | if (default_settings) { | 318 | if (default_settings) { |
| @@ -454,7 +457,12 @@ int main(int argc, char *argv[]) | |||
| 454 | else | 457 | else |
| 455 | printf("Queue open with total size > 2GB when euid = 0 " | 458 | printf("Queue open with total size > 2GB when euid = 0 " |
| 456 | "failed:\t\t\tPASS\n"); | 459 | "failed:\t\t\tPASS\n"); |
| 457 | seteuid(99); | 460 | |
| 461 | if (seteuid(99) == -1) { | ||
| 462 | perror("seteuid() failed"); | ||
| 463 | exit(1); | ||
| 464 | } | ||
| 465 | |||
| 458 | attr.mq_maxmsg = cur_max_msgs; | 466 | attr.mq_maxmsg = cur_max_msgs; |
| 459 | attr.mq_msgsize = cur_max_msgsize; | 467 | attr.mq_msgsize = cur_max_msgsize; |
| 460 | if (test_queue_fail(&attr, &result)) | 468 | if (test_queue_fail(&attr, &result)) |
diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c index 2fadd4b97045..94dae65eea41 100644 --- a/tools/testing/selftests/mqueue/mq_perf_tests.c +++ b/tools/testing/selftests/mqueue/mq_perf_tests.c | |||
| @@ -296,9 +296,9 @@ static inline void open_queue(struct mq_attr *attr) | |||
| 296 | printf("\n\tQueue %s created:\n", queue_path); | 296 | printf("\n\tQueue %s created:\n", queue_path); |
| 297 | printf("\t\tmq_flags:\t\t\t%s\n", result.mq_flags & O_NONBLOCK ? | 297 | printf("\t\tmq_flags:\t\t\t%s\n", result.mq_flags & O_NONBLOCK ? |
| 298 | "O_NONBLOCK" : "(null)"); | 298 | "O_NONBLOCK" : "(null)"); |
| 299 | printf("\t\tmq_maxmsg:\t\t\t%d\n", result.mq_maxmsg); | 299 | printf("\t\tmq_maxmsg:\t\t\t%lu\n", result.mq_maxmsg); |
| 300 | printf("\t\tmq_msgsize:\t\t\t%d\n", result.mq_msgsize); | 300 | printf("\t\tmq_msgsize:\t\t\t%lu\n", result.mq_msgsize); |
| 301 | printf("\t\tmq_curmsgs:\t\t\t%d\n", result.mq_curmsgs); | 301 | printf("\t\tmq_curmsgs:\t\t\t%lu\n", result.mq_curmsgs); |
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | void *fake_cont_thread(void *arg) | 304 | void *fake_cont_thread(void *arg) |
| @@ -440,7 +440,7 @@ void *perf_test_thread(void *arg) | |||
| 440 | shutdown(2, "clock_getres()", __LINE__); | 440 | shutdown(2, "clock_getres()", __LINE__); |
| 441 | 441 | ||
| 442 | printf("\t\tMax priorities:\t\t\t%d\n", mq_prio_max); | 442 | printf("\t\tMax priorities:\t\t\t%d\n", mq_prio_max); |
| 443 | printf("\t\tClock resolution:\t\t%d nsec%s\n", res.tv_nsec, | 443 | printf("\t\tClock resolution:\t\t%lu nsec%s\n", res.tv_nsec, |
| 444 | res.tv_nsec > 1 ? "s" : ""); | 444 | res.tv_nsec > 1 ? "s" : ""); |
| 445 | 445 | ||
| 446 | 446 | ||
| @@ -454,20 +454,20 @@ void *perf_test_thread(void *arg) | |||
| 454 | recv_total.tv_nsec = 0; | 454 | recv_total.tv_nsec = 0; |
| 455 | for (i = 0; i < TEST1_LOOPS; i++) | 455 | for (i = 0; i < TEST1_LOOPS; i++) |
| 456 | do_send_recv(); | 456 | do_send_recv(); |
| 457 | printf("\t\tSend msg:\t\t\t%d.%ds total time\n", | 457 | printf("\t\tSend msg:\t\t\t%ld.%lus total time\n", |
| 458 | send_total.tv_sec, send_total.tv_nsec); | 458 | send_total.tv_sec, send_total.tv_nsec); |
| 459 | nsec = ((unsigned long long)send_total.tv_sec * 1000000000 + | 459 | nsec = ((unsigned long long)send_total.tv_sec * 1000000000 + |
| 460 | send_total.tv_nsec) / TEST1_LOOPS; | 460 | send_total.tv_nsec) / TEST1_LOOPS; |
| 461 | printf("\t\t\t\t\t\t%d nsec/msg\n", nsec); | 461 | printf("\t\t\t\t\t\t%lld nsec/msg\n", nsec); |
| 462 | printf("\t\tRecv msg:\t\t\t%d.%ds total time\n", | 462 | printf("\t\tRecv msg:\t\t\t%ld.%lus total time\n", |
| 463 | recv_total.tv_sec, recv_total.tv_nsec); | 463 | recv_total.tv_sec, recv_total.tv_nsec); |
| 464 | nsec = ((unsigned long long)recv_total.tv_sec * 1000000000 + | 464 | nsec = ((unsigned long long)recv_total.tv_sec * 1000000000 + |
| 465 | recv_total.tv_nsec) / TEST1_LOOPS; | 465 | recv_total.tv_nsec) / TEST1_LOOPS; |
| 466 | printf("\t\t\t\t\t\t%d nsec/msg\n", nsec); | 466 | printf("\t\t\t\t\t\t%lld nsec/msg\n", nsec); |
| 467 | 467 | ||
| 468 | 468 | ||
| 469 | for (cur_test = test2; cur_test->desc != NULL; cur_test++) { | 469 | for (cur_test = test2; cur_test->desc != NULL; cur_test++) { |
| 470 | printf(cur_test->desc); | 470 | printf("%s:\n", cur_test->desc); |
| 471 | printf("\t\t(%d iterations)\n", TEST2_LOOPS); | 471 | printf("\t\t(%d iterations)\n", TEST2_LOOPS); |
| 472 | prio_out = 0; | 472 | prio_out = 0; |
| 473 | send_total.tv_sec = 0; | 473 | send_total.tv_sec = 0; |
| @@ -493,16 +493,16 @@ void *perf_test_thread(void *arg) | |||
| 493 | cur_test->func(&prio_out); | 493 | cur_test->func(&prio_out); |
| 494 | } | 494 | } |
| 495 | printf("done.\n"); | 495 | printf("done.\n"); |
| 496 | printf("\t\tSend msg:\t\t\t%d.%ds total time\n", | 496 | printf("\t\tSend msg:\t\t\t%ld.%lus total time\n", |
| 497 | send_total.tv_sec, send_total.tv_nsec); | 497 | send_total.tv_sec, send_total.tv_nsec); |
| 498 | nsec = ((unsigned long long)send_total.tv_sec * 1000000000 + | 498 | nsec = ((unsigned long long)send_total.tv_sec * 1000000000 + |
| 499 | send_total.tv_nsec) / TEST2_LOOPS; | 499 | send_total.tv_nsec) / TEST2_LOOPS; |
| 500 | printf("\t\t\t\t\t\t%d nsec/msg\n", nsec); | 500 | printf("\t\t\t\t\t\t%lld nsec/msg\n", nsec); |
| 501 | printf("\t\tRecv msg:\t\t\t%d.%ds total time\n", | 501 | printf("\t\tRecv msg:\t\t\t%ld.%lus total time\n", |
| 502 | recv_total.tv_sec, recv_total.tv_nsec); | 502 | recv_total.tv_sec, recv_total.tv_nsec); |
| 503 | nsec = ((unsigned long long)recv_total.tv_sec * 1000000000 + | 503 | nsec = ((unsigned long long)recv_total.tv_sec * 1000000000 + |
| 504 | recv_total.tv_nsec) / TEST2_LOOPS; | 504 | recv_total.tv_nsec) / TEST2_LOOPS; |
| 505 | printf("\t\t\t\t\t\t%d nsec/msg\n", nsec); | 505 | printf("\t\t\t\t\t\t%lld nsec/msg\n", nsec); |
| 506 | printf("\t\tDraining queue..."); | 506 | printf("\t\tDraining queue..."); |
| 507 | fflush(stdout); | 507 | fflush(stdout); |
| 508 | clock_gettime(clock, &start); | 508 | clock_gettime(clock, &start); |
| @@ -653,8 +653,10 @@ int main(int argc, char *argv[]) | |||
| 653 | /* Tell the user our initial state */ | 653 | /* Tell the user our initial state */ |
| 654 | printf("\nInitial system state:\n"); | 654 | printf("\nInitial system state:\n"); |
| 655 | printf("\tUsing queue path:\t\t\t%s\n", queue_path); | 655 | printf("\tUsing queue path:\t\t\t%s\n", queue_path); |
| 656 | printf("\tRLIMIT_MSGQUEUE(soft):\t\t\t%d\n", saved_limits.rlim_cur); | 656 | printf("\tRLIMIT_MSGQUEUE(soft):\t\t\t%ld\n", |
| 657 | printf("\tRLIMIT_MSGQUEUE(hard):\t\t\t%d\n", saved_limits.rlim_max); | 657 | (long) saved_limits.rlim_cur); |
| 658 | printf("\tRLIMIT_MSGQUEUE(hard):\t\t\t%ld\n", | ||
| 659 | (long) saved_limits.rlim_max); | ||
| 658 | printf("\tMaximum Message Size:\t\t\t%d\n", saved_max_msgsize); | 660 | printf("\tMaximum Message Size:\t\t\t%d\n", saved_max_msgsize); |
| 659 | printf("\tMaximum Queue Size:\t\t\t%d\n", saved_max_msgs); | 661 | printf("\tMaximum Queue Size:\t\t\t%d\n", saved_max_msgs); |
| 660 | printf("\tNice value:\t\t\t\t%d\n", cur_nice); | 662 | printf("\tNice value:\t\t\t\t%d\n", cur_nice); |
| @@ -667,10 +669,10 @@ int main(int argc, char *argv[]) | |||
| 667 | printf("\tRLIMIT_MSGQUEUE(soft):\t\t\t(unlimited)\n"); | 669 | printf("\tRLIMIT_MSGQUEUE(soft):\t\t\t(unlimited)\n"); |
| 668 | printf("\tRLIMIT_MSGQUEUE(hard):\t\t\t(unlimited)\n"); | 670 | printf("\tRLIMIT_MSGQUEUE(hard):\t\t\t(unlimited)\n"); |
| 669 | } else { | 671 | } else { |
| 670 | printf("\tRLIMIT_MSGQUEUE(soft):\t\t\t%d\n", | 672 | printf("\tRLIMIT_MSGQUEUE(soft):\t\t\t%ld\n", |
| 671 | cur_limits.rlim_cur); | 673 | (long) cur_limits.rlim_cur); |
| 672 | printf("\tRLIMIT_MSGQUEUE(hard):\t\t\t%d\n", | 674 | printf("\tRLIMIT_MSGQUEUE(hard):\t\t\t%ld\n", |
| 673 | cur_limits.rlim_max); | 675 | (long) cur_limits.rlim_max); |
| 674 | } | 676 | } |
| 675 | printf("\tMaximum Message Size:\t\t\t%d\n", cur_max_msgsize); | 677 | printf("\tMaximum Message Size:\t\t\t%d\n", cur_max_msgsize); |
| 676 | printf("\tMaximum Queue Size:\t\t\t%d\n", cur_max_msgs); | 678 | printf("\tMaximum Queue Size:\t\t\t%d\n", cur_max_msgs); |
