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 | |
| 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')
| -rw-r--r-- | tools/hv/hv_fcopy_daemon.c | 3 | ||||
| -rw-r--r-- | tools/testing/selftests/Makefile | 18 | ||||
| -rw-r--r-- | tools/testing/selftests/README.txt | 27 | ||||
| -rw-r--r-- | tools/testing/selftests/cpu-hotplug/Makefile | 3 | ||||
| -rw-r--r-- | tools/testing/selftests/cpu-hotplug/on-off-test.sh | 52 | ||||
| -rw-r--r-- | tools/testing/selftests/kcmp/kcmp_test.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/memory-hotplug/Makefile | 3 | ||||
| -rw-r--r-- | tools/testing/selftests/memory-hotplug/on-off-test.sh | 8 | ||||
| -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 |
11 files changed, 145 insertions, 35 deletions
diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c index fba1c75aa484..8f96b3ee0724 100644 --- a/tools/hv/hv_fcopy_daemon.c +++ b/tools/hv/hv_fcopy_daemon.c | |||
| @@ -88,7 +88,8 @@ static int hv_start_fcopy(struct hv_start_fcopy *smsg) | |||
| 88 | } | 88 | } |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | target_fd = open(target_fname, O_RDWR | O_CREAT | O_CLOEXEC, 0744); | 91 | target_fd = open(target_fname, |
| 92 | O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, 0744); | ||
| 92 | if (target_fd == -1) { | 93 | if (target_fd == -1) { |
| 93 | syslog(LOG_INFO, "Open Failed: %s", strerror(errno)); | 94 | syslog(LOG_INFO, "Open Failed: %s", strerror(errno)); |
| 94 | goto done; | 95 | goto done; |
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index e66e710cc595..4c2aa357e12f 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile | |||
| @@ -12,6 +12,9 @@ TARGETS += powerpc | |||
| 12 | TARGETS += user | 12 | TARGETS += user |
| 13 | TARGETS += sysctl | 13 | TARGETS += sysctl |
| 14 | 14 | ||
| 15 | TARGETS_HOTPLUG = cpu-hotplug | ||
| 16 | TARGETS_HOTPLUG += memory-hotplug | ||
| 17 | |||
| 15 | all: | 18 | all: |
| 16 | for TARGET in $(TARGETS); do \ | 19 | for TARGET in $(TARGETS); do \ |
| 17 | make -C $$TARGET; \ | 20 | make -C $$TARGET; \ |
| @@ -22,6 +25,21 @@ run_tests: all | |||
| 22 | make -C $$TARGET run_tests; \ | 25 | make -C $$TARGET run_tests; \ |
| 23 | done; | 26 | done; |
| 24 | 27 | ||
| 28 | hotplug: | ||
| 29 | for TARGET in $(TARGETS_HOTPLUG); do \ | ||
| 30 | make -C $$TARGET; \ | ||
| 31 | done; | ||
| 32 | |||
| 33 | run_hotplug: hotplug | ||
| 34 | for TARGET in $(TARGETS_HOTPLUG); do \ | ||
| 35 | make -C $$TARGET run_full_test; \ | ||
| 36 | done; | ||
| 37 | |||
| 38 | clean_hotplug: | ||
| 39 | for TARGET in $(TARGETS_HOTPLUG); do \ | ||
| 40 | make -C $$TARGET clean; \ | ||
| 41 | done; | ||
| 42 | |||
| 25 | clean: | 43 | clean: |
| 26 | for TARGET in $(TARGETS); do \ | 44 | for TARGET in $(TARGETS); do \ |
| 27 | make -C $$TARGET clean; \ | 45 | make -C $$TARGET clean; \ |
diff --git a/tools/testing/selftests/README.txt b/tools/testing/selftests/README.txt index 5e2faf9c55d3..2660d5ff9179 100644 --- a/tools/testing/selftests/README.txt +++ b/tools/testing/selftests/README.txt | |||
| @@ -4,8 +4,15 @@ The kernel contains a set of "self tests" under the tools/testing/selftests/ | |||
| 4 | directory. These are intended to be small unit tests to exercise individual | 4 | directory. These are intended to be small unit tests to exercise individual |
| 5 | code paths in the kernel. | 5 | code paths in the kernel. |
| 6 | 6 | ||
| 7 | Running the selftests | 7 | On some systems, hot-plug tests could hang forever waiting for cpu and |
| 8 | ===================== | 8 | memory to be ready to be offlined. A special hot-plug target is created |
| 9 | to run full range of hot-plug tests. In default mode, hot-plug tests run | ||
| 10 | in safe mode with a limited scope. In limited mode, cpu-hotplug test is | ||
| 11 | run on a single cpu as opposed to all hotplug capable cpus, and memory | ||
| 12 | hotplug test is run on 2% of hotplug capable memory instead of 10%. | ||
| 13 | |||
| 14 | Running the selftests (hotplug tests are run in limited mode) | ||
| 15 | ============================================================= | ||
| 9 | 16 | ||
| 10 | To build the tests: | 17 | To build the tests: |
| 11 | 18 | ||
| @@ -18,14 +25,26 @@ To run the tests: | |||
| 18 | 25 | ||
| 19 | - note that some tests will require root privileges. | 26 | - note that some tests will require root privileges. |
| 20 | 27 | ||
| 21 | 28 | To run only tests targeted for a single subsystem: (including | |
| 22 | To run only tests targetted for a single subsystem: | 29 | hotplug targets in limited mode) |
| 23 | 30 | ||
| 24 | $ make -C tools/testing/selftests TARGETS=cpu-hotplug run_tests | 31 | $ make -C tools/testing/selftests TARGETS=cpu-hotplug run_tests |
| 25 | 32 | ||
| 26 | See the top-level tools/testing/selftests/Makefile for the list of all possible | 33 | See the top-level tools/testing/selftests/Makefile for the list of all possible |
| 27 | targets. | 34 | targets. |
| 28 | 35 | ||
| 36 | Running the full range hotplug selftests | ||
| 37 | ======================================== | ||
| 38 | |||
| 39 | To build the tests: | ||
| 40 | |||
| 41 | $ make -C tools/testing/selftests hotplug | ||
| 42 | |||
| 43 | To run the tests: | ||
| 44 | |||
| 45 | $ make -C tools/testing/selftests run_hotplug | ||
| 46 | |||
| 47 | - note that some tests will require root privileges. | ||
| 29 | 48 | ||
| 30 | Contributing new tests | 49 | Contributing new tests |
| 31 | ====================== | 50 | ====================== |
diff --git a/tools/testing/selftests/cpu-hotplug/Makefile b/tools/testing/selftests/cpu-hotplug/Makefile index 790c23a9db44..e9c28d8dc84b 100644 --- a/tools/testing/selftests/cpu-hotplug/Makefile +++ b/tools/testing/selftests/cpu-hotplug/Makefile | |||
| @@ -3,4 +3,7 @@ all: | |||
| 3 | run_tests: | 3 | run_tests: |
| 4 | @/bin/bash ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" | 4 | @/bin/bash ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" |
| 5 | 5 | ||
| 6 | run_full_test: | ||
| 7 | @/bin/bash ./on-off-test.sh -a || echo "cpu-hotplug selftests: [FAIL]" | ||
| 8 | |||
| 6 | clean: | 9 | clean: |
diff --git a/tools/testing/selftests/cpu-hotplug/on-off-test.sh b/tools/testing/selftests/cpu-hotplug/on-off-test.sh index bdde7cf428bb..98b1d6565f2c 100644 --- a/tools/testing/selftests/cpu-hotplug/on-off-test.sh +++ b/tools/testing/selftests/cpu-hotplug/on-off-test.sh | |||
| @@ -11,6 +11,8 @@ prerequisite() | |||
| 11 | exit 0 | 11 | exit 0 |
| 12 | fi | 12 | fi |
| 13 | 13 | ||
| 14 | taskset -p 01 $$ | ||
| 15 | |||
| 14 | SYSFS=`mount -t sysfs | head -1 | awk '{ print $3 }'` | 16 | SYSFS=`mount -t sysfs | head -1 | awk '{ print $3 }'` |
| 15 | 17 | ||
| 16 | if [ ! -d "$SYSFS" ]; then | 18 | if [ ! -d "$SYSFS" ]; then |
| @@ -22,6 +24,19 @@ prerequisite() | |||
| 22 | echo $msg cpu hotplug is not supported >&2 | 24 | echo $msg cpu hotplug is not supported >&2 |
| 23 | exit 0 | 25 | exit 0 |
| 24 | fi | 26 | fi |
| 27 | |||
| 28 | echo "CPU online/offline summary:" | ||
| 29 | online_cpus=`cat $SYSFS/devices/system/cpu/online` | ||
| 30 | online_max=${online_cpus##*-} | ||
| 31 | echo -e "\t Cpus in online state: $online_cpus" | ||
| 32 | |||
| 33 | offline_cpus=`cat $SYSFS/devices/system/cpu/offline` | ||
| 34 | if [[ "a$offline_cpus" = "a" ]]; then | ||
| 35 | offline_cpus=0 | ||
| 36 | else | ||
| 37 | offline_max=${offline_cpus##*-} | ||
| 38 | fi | ||
| 39 | echo -e "\t Cpus in offline state: $offline_cpus" | ||
| 25 | } | 40 | } |
| 26 | 41 | ||
| 27 | # | 42 | # |
| @@ -113,15 +128,25 @@ offline_cpu_expect_fail() | |||
| 113 | } | 128 | } |
| 114 | 129 | ||
| 115 | error=-12 | 130 | error=-12 |
| 131 | allcpus=0 | ||
| 116 | priority=0 | 132 | priority=0 |
| 133 | online_cpus=0 | ||
| 134 | online_max=0 | ||
| 135 | offline_cpus=0 | ||
| 136 | offline_max=0 | ||
| 117 | 137 | ||
| 118 | while getopts e:hp: opt; do | 138 | while getopts e:ahp: opt; do |
| 119 | case $opt in | 139 | case $opt in |
| 120 | e) | 140 | e) |
| 121 | error=$OPTARG | 141 | error=$OPTARG |
| 122 | ;; | 142 | ;; |
| 143 | a) | ||
| 144 | allcpus=1 | ||
| 145 | ;; | ||
| 123 | h) | 146 | h) |
| 124 | echo "Usage $0 [ -e errno ] [ -p notifier-priority ]" | 147 | echo "Usage $0 [ -a ] [ -e errno ] [ -p notifier-priority ]" |
| 148 | echo -e "\t default offline one cpu" | ||
| 149 | echo -e "\t run with -a option to offline all cpus" | ||
| 125 | exit | 150 | exit |
| 126 | ;; | 151 | ;; |
| 127 | p) | 152 | p) |
| @@ -138,6 +163,29 @@ fi | |||
| 138 | prerequisite | 163 | prerequisite |
| 139 | 164 | ||
| 140 | # | 165 | # |
| 166 | # Safe test (default) - offline and online one cpu | ||
| 167 | # | ||
| 168 | if [ $allcpus -eq 0 ]; then | ||
| 169 | echo "Limited scope test: one hotplug cpu" | ||
| 170 | echo -e "\t (leaves cpu in the original state):" | ||
| 171 | echo -e "\t online to offline to online: cpu $online_max" | ||
| 172 | offline_cpu_expect_success $online_max | ||
| 173 | online_cpu_expect_success $online_max | ||
| 174 | |||
| 175 | if [[ $offline_cpus -gt 0 ]]; then | ||
| 176 | echo -e "\t offline to online to offline: cpu $offline_max" | ||
| 177 | online_cpu_expect_success $offline_max | ||
| 178 | offline_cpu_expect_success $offline_max | ||
| 179 | fi | ||
| 180 | exit 0 | ||
| 181 | else | ||
| 182 | echo "Full scope test: all hotplug cpus" | ||
| 183 | echo -e "\t online all offline cpus" | ||
| 184 | echo -e "\t offline all online cpus" | ||
| 185 | echo -e "\t online all offline cpus" | ||
| 186 | fi | ||
| 187 | |||
| 188 | # | ||
| 141 | # Online all hot-pluggable CPUs | 189 | # Online all hot-pluggable CPUs |
| 142 | # | 190 | # |
| 143 | for cpu in `hotplaggable_offline_cpus`; do | 191 | for cpu in `hotplaggable_offline_cpus`; do |
diff --git a/tools/testing/selftests/kcmp/kcmp_test.c b/tools/testing/selftests/kcmp/kcmp_test.c index fa4f1b37e045..dbba4084869c 100644 --- a/tools/testing/selftests/kcmp/kcmp_test.c +++ b/tools/testing/selftests/kcmp/kcmp_test.c | |||
| @@ -81,7 +81,7 @@ int main(int argc, char **argv) | |||
| 81 | /* Compare with self */ | 81 | /* Compare with self */ |
| 82 | ret = sys_kcmp(pid1, pid1, KCMP_VM, 0, 0); | 82 | ret = sys_kcmp(pid1, pid1, KCMP_VM, 0, 0); |
| 83 | if (ret) { | 83 | if (ret) { |
| 84 | printf("FAIL: 0 expected but %li returned (%s)\n", | 84 | printf("FAIL: 0 expected but %d returned (%s)\n", |
| 85 | ret, strerror(errno)); | 85 | ret, strerror(errno)); |
| 86 | ret = -1; | 86 | ret = -1; |
| 87 | } else | 87 | } else |
diff --git a/tools/testing/selftests/memory-hotplug/Makefile b/tools/testing/selftests/memory-hotplug/Makefile index 058c76f5d102..d46b8d489cd2 100644 --- a/tools/testing/selftests/memory-hotplug/Makefile +++ b/tools/testing/selftests/memory-hotplug/Makefile | |||
| @@ -1,6 +1,9 @@ | |||
| 1 | all: | 1 | all: |
| 2 | 2 | ||
| 3 | run_tests: | 3 | run_tests: |
| 4 | @/bin/bash ./on-off-test.sh -r 2 || echo "memory-hotplug selftests: [FAIL]" | ||
| 5 | |||
| 6 | run_full_test: | ||
| 4 | @/bin/bash ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" | 7 | @/bin/bash ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" |
| 5 | 8 | ||
| 6 | clean: | 9 | clean: |
diff --git a/tools/testing/selftests/memory-hotplug/on-off-test.sh b/tools/testing/selftests/memory-hotplug/on-off-test.sh index a2816f631542..6cddde0b96f8 100644 --- a/tools/testing/selftests/memory-hotplug/on-off-test.sh +++ b/tools/testing/selftests/memory-hotplug/on-off-test.sh | |||
| @@ -142,10 +142,16 @@ fi | |||
| 142 | 142 | ||
| 143 | prerequisite | 143 | prerequisite |
| 144 | 144 | ||
| 145 | echo "Test scope: $ratio% hotplug memory" | ||
| 146 | echo -e "\t online all hotplug memory in offline state" | ||
| 147 | echo -e "\t offline $ratio% hotplug memory in online state" | ||
| 148 | echo -e "\t online all hotplug memory in offline state" | ||
| 149 | |||
| 145 | # | 150 | # |
| 146 | # Online all hot-pluggable memory | 151 | # Online all hot-pluggable memory |
| 147 | # | 152 | # |
| 148 | for memory in `hotplaggable_offline_memory`; do | 153 | for memory in `hotplaggable_offline_memory`; do |
| 154 | echo offline-online $memory | ||
| 149 | online_memory_expect_success $memory | 155 | online_memory_expect_success $memory |
| 150 | done | 156 | done |
| 151 | 157 | ||
| @@ -154,6 +160,7 @@ done | |||
| 154 | # | 160 | # |
| 155 | for memory in `hotpluggable_online_memory`; do | 161 | for memory in `hotpluggable_online_memory`; do |
| 156 | if [ $((RANDOM % 100)) -lt $ratio ]; then | 162 | if [ $((RANDOM % 100)) -lt $ratio ]; then |
| 163 | echo online-offline $memory | ||
| 157 | offline_memory_expect_success $memory | 164 | offline_memory_expect_success $memory |
| 158 | fi | 165 | fi |
| 159 | done | 166 | done |
| @@ -162,6 +169,7 @@ done | |||
| 162 | # Online all hot-pluggable memory again | 169 | # Online all hot-pluggable memory again |
| 163 | # | 170 | # |
| 164 | for memory in `hotplaggable_offline_memory`; do | 171 | for memory in `hotplaggable_offline_memory`; do |
| 172 | echo offline-online $memory | ||
| 165 | online_memory_expect_success $memory | 173 | online_memory_expect_success $memory |
| 166 | done | 174 | done |
| 167 | 175 | ||
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); |
