diff options
| author | Benjamin LaHaise <bcrl@kvack.org> | 2014-07-14 13:14:27 -0400 |
|---|---|---|
| committer | Benjamin LaHaise <bcrl@kvack.org> | 2014-07-14 13:14:27 -0400 |
| commit | 6e830d53717cf3d5c30c1afce3773ef97e436cd9 (patch) | |
| tree | 9376a0424b8f9fff12d107aa2498e775da20e85d /tools | |
| parent | 855ef0dec7271ff7be7381feaaf3f4aed80bd503 (diff) | |
| parent | 263782c1c95bbddbb022dc092fd89a36bb8d5577 (diff) | |
Merge ../aio-fixes
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/testing/selftests/cpu-hotplug/Makefile | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/ipc/msgque.c | 5 | ||||
| -rw-r--r-- | tools/testing/selftests/memory-hotplug/Makefile | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/powerpc/tm/Makefile | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/powerpc/tm/tm-resched-dscr.c | 14 | ||||
| -rw-r--r-- | tools/thermal/tmon/Makefile | 2 | ||||
| -rw-r--r-- | tools/thermal/tmon/tmon.c | 26 | ||||
| -rw-r--r-- | tools/usb/ffs-test.c | 4 |
8 files changed, 47 insertions, 10 deletions
diff --git a/tools/testing/selftests/cpu-hotplug/Makefile b/tools/testing/selftests/cpu-hotplug/Makefile index ae5faf9aade2..790c23a9db44 100644 --- a/tools/testing/selftests/cpu-hotplug/Makefile +++ b/tools/testing/selftests/cpu-hotplug/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | all: | 1 | all: |
| 2 | 2 | ||
| 3 | run_tests: | 3 | run_tests: |
| 4 | @/bin/sh ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" | 4 | @/bin/bash ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" |
| 5 | 5 | ||
| 6 | clean: | 6 | clean: |
diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c index aa290c0de6f5..552f0810bffb 100644 --- a/tools/testing/selftests/ipc/msgque.c +++ b/tools/testing/selftests/ipc/msgque.c | |||
| @@ -193,6 +193,11 @@ int main(int argc, char **argv) | |||
| 193 | int msg, pid, err; | 193 | int msg, pid, err; |
| 194 | struct msgque_data msgque; | 194 | struct msgque_data msgque; |
| 195 | 195 | ||
| 196 | if (getuid() != 0) { | ||
| 197 | printf("Please run the test as root - Exiting.\n"); | ||
| 198 | exit(1); | ||
| 199 | } | ||
| 200 | |||
| 196 | msgque.key = ftok(argv[0], 822155650); | 201 | msgque.key = ftok(argv[0], 822155650); |
| 197 | if (msgque.key == -1) { | 202 | if (msgque.key == -1) { |
| 198 | printf("Can't make key\n"); | 203 | printf("Can't make key\n"); |
diff --git a/tools/testing/selftests/memory-hotplug/Makefile b/tools/testing/selftests/memory-hotplug/Makefile index 350bfeda3aa8..058c76f5d102 100644 --- a/tools/testing/selftests/memory-hotplug/Makefile +++ b/tools/testing/selftests/memory-hotplug/Makefile | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | all: | 1 | all: |
| 2 | 2 | ||
| 3 | run_tests: | 3 | run_tests: |
| 4 | @/bin/sh ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" | 4 | @/bin/bash ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" |
| 5 | 5 | ||
| 6 | clean: | 6 | clean: |
diff --git a/tools/testing/selftests/powerpc/tm/Makefile b/tools/testing/selftests/powerpc/tm/Makefile index 51267f4184a6..2cede239a074 100644 --- a/tools/testing/selftests/powerpc/tm/Makefile +++ b/tools/testing/selftests/powerpc/tm/Makefile | |||
| @@ -2,7 +2,7 @@ PROGS := tm-resched-dscr | |||
| 2 | 2 | ||
| 3 | all: $(PROGS) | 3 | all: $(PROGS) |
| 4 | 4 | ||
| 5 | $(PROGS): | 5 | $(PROGS): ../harness.c |
| 6 | 6 | ||
| 7 | run_tests: all | 7 | run_tests: all |
| 8 | @-for PROG in $(PROGS); do \ | 8 | @-for PROG in $(PROGS); do \ |
diff --git a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c index ee98e3886af2..42d4c8caad81 100644 --- a/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c +++ b/tools/testing/selftests/powerpc/tm/tm-resched-dscr.c | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | #include <assert.h> | 28 | #include <assert.h> |
| 29 | #include <asm/tm.h> | 29 | #include <asm/tm.h> |
| 30 | 30 | ||
| 31 | #include "utils.h" | ||
| 32 | |||
| 31 | #define TBEGIN ".long 0x7C00051D ;" | 33 | #define TBEGIN ".long 0x7C00051D ;" |
| 32 | #define TEND ".long 0x7C00055D ;" | 34 | #define TEND ".long 0x7C00055D ;" |
| 33 | #define TCHECK ".long 0x7C00059C ;" | 35 | #define TCHECK ".long 0x7C00059C ;" |
| @@ -36,7 +38,8 @@ | |||
| 36 | #define SPRN_TEXASR 0x82 | 38 | #define SPRN_TEXASR 0x82 |
| 37 | #define SPRN_DSCR 0x03 | 39 | #define SPRN_DSCR 0x03 |
| 38 | 40 | ||
| 39 | int main(void) { | 41 | int test_body(void) |
| 42 | { | ||
| 40 | uint64_t rv, dscr1 = 1, dscr2, texasr; | 43 | uint64_t rv, dscr1 = 1, dscr2, texasr; |
| 41 | 44 | ||
| 42 | printf("Check DSCR TM context switch: "); | 45 | printf("Check DSCR TM context switch: "); |
| @@ -81,10 +84,15 @@ int main(void) { | |||
| 81 | } | 84 | } |
| 82 | if (dscr2 != dscr1) { | 85 | if (dscr2 != dscr1) { |
| 83 | printf(" FAIL\n"); | 86 | printf(" FAIL\n"); |
| 84 | exit(EXIT_FAILURE); | 87 | return 1; |
| 85 | } else { | 88 | } else { |
| 86 | printf(" OK\n"); | 89 | printf(" OK\n"); |
| 87 | exit(EXIT_SUCCESS); | 90 | return 0; |
| 88 | } | 91 | } |
| 89 | } | 92 | } |
| 90 | } | 93 | } |
| 94 | |||
| 95 | int main(void) | ||
| 96 | { | ||
| 97 | return test_harness(test_body, "tm_resched_dscr"); | ||
| 98 | } | ||
diff --git a/tools/thermal/tmon/Makefile b/tools/thermal/tmon/Makefile index 447321104ec0..e775adcbd29f 100644 --- a/tools/thermal/tmon/Makefile +++ b/tools/thermal/tmon/Makefile | |||
| @@ -21,7 +21,7 @@ OBJS = tmon.o tui.o sysfs.o pid.o | |||
| 21 | OBJS += | 21 | OBJS += |
| 22 | 22 | ||
| 23 | tmon: $(OBJS) Makefile tmon.h | 23 | tmon: $(OBJS) Makefile tmon.h |
| 24 | $(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -o $(TARGET) -lm -lpanel -lncursesw -lpthread | 24 | $(CC) ${CFLAGS} $(LDFLAGS) $(OBJS) -o $(TARGET) -lm -lpanel -lncursesw -ltinfo -lpthread |
| 25 | 25 | ||
| 26 | valgrind: tmon | 26 | valgrind: tmon |
| 27 | sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET) 1> /dev/null | 27 | sudo valgrind -v --track-origins=yes --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes ./$(TARGET) 1> /dev/null |
diff --git a/tools/thermal/tmon/tmon.c b/tools/thermal/tmon/tmon.c index b30f531173e4..09b7c3218334 100644 --- a/tools/thermal/tmon/tmon.c +++ b/tools/thermal/tmon/tmon.c | |||
| @@ -142,6 +142,7 @@ static void start_syslog(void) | |||
| 142 | static void prepare_logging(void) | 142 | static void prepare_logging(void) |
| 143 | { | 143 | { |
| 144 | int i; | 144 | int i; |
| 145 | struct stat logstat; | ||
| 145 | 146 | ||
| 146 | if (!logging) | 147 | if (!logging) |
| 147 | return; | 148 | return; |
| @@ -152,6 +153,29 @@ static void prepare_logging(void) | |||
| 152 | return; | 153 | return; |
| 153 | } | 154 | } |
| 154 | 155 | ||
| 156 | if (lstat(TMON_LOG_FILE, &logstat) < 0) { | ||
| 157 | syslog(LOG_ERR, "Unable to stat log file %s\n", TMON_LOG_FILE); | ||
| 158 | fclose(tmon_log); | ||
| 159 | tmon_log = NULL; | ||
| 160 | return; | ||
| 161 | } | ||
| 162 | |||
| 163 | /* The log file must be a regular file owned by us */ | ||
| 164 | if (S_ISLNK(logstat.st_mode)) { | ||
| 165 | syslog(LOG_ERR, "Log file is a symlink. Will not log\n"); | ||
| 166 | fclose(tmon_log); | ||
| 167 | tmon_log = NULL; | ||
| 168 | return; | ||
| 169 | } | ||
| 170 | |||
| 171 | if (logstat.st_uid != getuid()) { | ||
| 172 | syslog(LOG_ERR, "We don't own the log file. Not logging\n"); | ||
| 173 | fclose(tmon_log); | ||
| 174 | tmon_log = NULL; | ||
| 175 | return; | ||
| 176 | } | ||
| 177 | |||
| 178 | |||
| 155 | fprintf(tmon_log, "#----------- THERMAL SYSTEM CONFIG -------------\n"); | 179 | fprintf(tmon_log, "#----------- THERMAL SYSTEM CONFIG -------------\n"); |
| 156 | for (i = 0; i < ptdata.nr_tz_sensor; i++) { | 180 | for (i = 0; i < ptdata.nr_tz_sensor; i++) { |
| 157 | char binding_str[33]; /* size of long + 1 */ | 181 | char binding_str[33]; /* size of long + 1 */ |
| @@ -331,7 +355,7 @@ static void start_daemon_mode() | |||
| 331 | disable_tui(); | 355 | disable_tui(); |
| 332 | 356 | ||
| 333 | /* change the file mode mask */ | 357 | /* change the file mode mask */ |
| 334 | umask(0); | 358 | umask(S_IWGRP | S_IWOTH); |
| 335 | 359 | ||
| 336 | /* new SID for the daemon process */ | 360 | /* new SID for the daemon process */ |
| 337 | sid = setsid(); | 361 | sid = setsid(); |
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c index fe1e66b6ef40..a87e99f37c52 100644 --- a/tools/usb/ffs-test.c +++ b/tools/usb/ffs-test.c | |||
| @@ -116,8 +116,8 @@ static const struct { | |||
| 116 | .header = { | 116 | .header = { |
| 117 | .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC), | 117 | .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC), |
| 118 | .length = cpu_to_le32(sizeof descriptors), | 118 | .length = cpu_to_le32(sizeof descriptors), |
| 119 | .fs_count = 3, | 119 | .fs_count = cpu_to_le32(3), |
| 120 | .hs_count = 3, | 120 | .hs_count = cpu_to_le32(3), |
| 121 | }, | 121 | }, |
| 122 | .fs_descs = { | 122 | .fs_descs = { |
| 123 | .intf = { | 123 | .intf = { |
