Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'linux-kselftest-next-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull Kselftest update from Shuah Khan:
"Fixes to existing tests and framework:

- migrate sgx test to kselftest harness

- add new test cases to sgx test

- ftrace test fix event-no-pid on 1-core machine

- splice test adjust for handler fallback removal"

* tag 'linux-kselftest-next-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
selftests/sgx: remove checks for file execute permissions
selftests/ftrace: fix event-no-pid on 1-core machine
selftests/sgx: Refine the test enclave to have storage
selftests/sgx: Add EXPECT_EEXIT() macro
selftests/sgx: Dump enclave memory map
selftests/sgx: Migrate to kselftest harness
selftests/sgx: Rename 'eenter' and 'sgx_call_vdso'
selftests: timers: rtcpie: skip test if default RTC device does not exist
selftests: lib.mk: Also install "config" and "settings"
selftests: splice: Adjust for handler fallback removal
selftests/tls: Add {} to avoid static checker warning
selftests/resctrl: Fix incorrect parsing of option "-t"

+309 -139
+7
tools/testing/selftests/ftrace/test.d/event/event-no-pid.tc
··· 57 57 echo 1 > tracing_on 58 58 } 59 59 60 + other_task() { 61 + sleep .001 || usleep 1 || sleep 1 62 + } 63 + 60 64 echo 0 > options/event-fork 61 65 62 66 do_reset ··· 97 93 child=$! 98 94 echo "child = $child" 99 95 wait $child 96 + 97 + # Be sure some other events will happen for small systems (e.g. 1 core) 98 + other_task 100 99 101 100 echo 0 > tracing_on 102 101
+1
tools/testing/selftests/lib.mk
··· 100 100 $(eval INSTALL_LIST = $(TEST_CUSTOM_PROGS)) $(INSTALL_SINGLE_RULE) 101 101 $(eval INSTALL_LIST = $(TEST_GEN_PROGS_EXTENDED)) $(INSTALL_SINGLE_RULE) 102 102 $(eval INSTALL_LIST = $(TEST_GEN_FILES)) $(INSTALL_SINGLE_RULE) 103 + $(eval INSTALL_LIST = $(wildcard config settings)) $(INSTALL_SINGLE_RULE) 103 104 endef 104 105 105 106 install: all
+2 -1
tools/testing/selftests/net/tls.c
··· 444 444 EXPECT_EQ(sendmsg(self->cfd, &msg, 0), send_len); 445 445 } 446 446 447 - while (recvs++ < sends) 447 + while (recvs++ < sends) { 448 448 EXPECT_NE(recv(self->fd, mem, send_len, 0), -1); 449 + } 449 450 450 451 free(mem); 451 452 }
+1 -1
tools/testing/selftests/resctrl/README
··· 47 47 48 48 usage: resctrl_tests [-h] [-b "benchmark_cmd [options]"] [-t test list] [-n no_of_bits] 49 49 -b benchmark_cmd [options]: run specified benchmark for MBM, MBA and CMT default benchmark is builtin fill_buf 50 - -t test list: run tests specified in the test list, e.g. -t mbm, mba, cmt, cat 50 + -t test list: run tests specified in the test list, e.g. -t mbm,mba,cmt,cat 51 51 -n no_of_bits: run cache tests using specified no of bits in cache bit mask 52 52 -p cpu_no: specify CPU number to run the test. 1 is default 53 53 -h: help
+2 -2
tools/testing/selftests/resctrl/resctrl_tests.c
··· 40 40 printf("\t-b benchmark_cmd [options]: run specified benchmark for MBM, MBA and CMT\n"); 41 41 printf("\t default benchmark is builtin fill_buf\n"); 42 42 printf("\t-t test list: run tests specified in the test list, "); 43 - printf("e.g. -t mbm, mba, cmt, cat\n"); 43 + printf("e.g. -t mbm,mba,cmt,cat\n"); 44 44 printf("\t-n no_of_bits: run cache tests using specified no of bits in cache bit mask\n"); 45 45 printf("\t-p cpu_no: specify CPU number to run the test. 1 is default\n"); 46 46 printf("\t-h: help\n"); ··· 173 173 174 174 return -1; 175 175 } 176 - token = strtok(NULL, ":\t"); 176 + token = strtok(NULL, ","); 177 177 } 178 178 break; 179 179 case 'p':
+3 -3
tools/testing/selftests/sgx/call.S
··· 5 5 6 6 .text 7 7 8 - .global sgx_call_vdso 9 - sgx_call_vdso: 8 + .global sgx_enter_enclave 9 + sgx_enter_enclave: 10 10 .cfi_startproc 11 11 push %r15 12 12 .cfi_adjust_cfa_offset 8 ··· 27 27 .cfi_adjust_cfa_offset 8 28 28 push 0x38(%rsp) 29 29 .cfi_adjust_cfa_offset 8 30 - call *eenter(%rip) 30 + call *vdso_sgx_enter_enclave(%rip) 31 31 add $0x10, %rsp 32 32 .cfi_adjust_cfa_offset -0x10 33 33 pop %rbx
+10
tools/testing/selftests/sgx/defines.h
··· 18 18 #include "../../../../arch/x86/include/asm/enclu.h" 19 19 #include "../../../../arch/x86/include/uapi/asm/sgx.h" 20 20 21 + enum encl_op_type { 22 + ENCL_OP_PUT, 23 + ENCL_OP_GET, 24 + }; 25 + 26 + struct encl_op { 27 + uint64_t type; 28 + uint64_t buffer; 29 + }; 30 + 21 31 #endif /* DEFINES_H */
+3 -16
tools/testing/selftests/sgx/load.c
··· 150 150 goto err; 151 151 } 152 152 153 - /* 154 - * This just checks if the /dev file has these permission 155 - * bits set. It does not check that the current user is 156 - * the owner or in the owning group. 157 - */ 158 - if (!(sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) { 159 - fprintf(stderr, "no execute permissions on device file %s\n", device_path); 160 - goto err; 161 - } 162 - 163 153 ptr = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, fd, 0); 164 154 if (ptr == (void *)-1) { 165 155 perror("mmap for read"); ··· 159 169 160 170 #define ERR_MSG \ 161 171 "mmap() succeeded for PROT_READ, but failed for PROT_EXEC.\n" \ 162 - " Check that current user has execute permissions on %s and \n" \ 163 - " that /dev does not have noexec set: mount | grep \"/dev .*noexec\"\n" \ 172 + " Check that /dev does not have noexec set:\n" \ 173 + " \tmount | grep \"/dev .*noexec\"\n" \ 164 174 " If so, remount it executable: mount -o remount,exec /dev\n\n" 165 175 166 176 ptr = mmap(NULL, PAGE_SIZE, PROT_EXEC, MAP_SHARED, fd, 0); 167 177 if (ptr == (void *)-1) { 168 - fprintf(stderr, ERR_MSG, device_path); 178 + fprintf(stderr, ERR_MSG); 169 179 goto err; 170 180 } 171 181 munmap(ptr, PAGE_SIZE); ··· 228 238 229 239 seg->offset = (phdr->p_offset & PAGE_MASK) - src_offset; 230 240 seg->size = (phdr->p_filesz + PAGE_SIZE - 1) & PAGE_MASK; 231 - 232 - printf("0x%016lx 0x%016lx 0x%02x\n", seg->offset, seg->size, 233 - seg->prot); 234 241 235 242 j++; 236 243 }
+152 -89
tools/testing/selftests/sgx/main.c
··· 17 17 #include <sys/types.h> 18 18 #include <sys/auxv.h> 19 19 #include "defines.h" 20 + #include "../kselftest_harness.h" 20 21 #include "main.h" 21 - #include "../kselftest.h" 22 22 23 23 static const uint64_t MAGIC = 0x1122334455667788ULL; 24 - vdso_sgx_enter_enclave_t eenter; 24 + vdso_sgx_enter_enclave_t vdso_sgx_enter_enclave; 25 25 26 26 struct vdso_symtab { 27 27 Elf64_Sym *elf_symtab; ··· 107 107 return NULL; 108 108 } 109 109 110 - bool report_results(struct sgx_enclave_run *run, int ret, uint64_t result, 111 - const char *test) 112 - { 113 - bool valid = true; 114 - 115 - if (ret) { 116 - printf("FAIL: %s() returned: %d\n", test, ret); 117 - valid = false; 118 - } 119 - 120 - if (run->function != EEXIT) { 121 - printf("FAIL: %s() function, expected: %u, got: %u\n", test, EEXIT, 122 - run->function); 123 - valid = false; 124 - } 125 - 126 - if (result != MAGIC) { 127 - printf("FAIL: %s(), expected: 0x%lx, got: 0x%lx\n", test, MAGIC, 128 - result); 129 - valid = false; 130 - } 131 - 132 - if (run->user_data) { 133 - printf("FAIL: %s() user data, expected: 0x0, got: 0x%llx\n", 134 - test, run->user_data); 135 - valid = false; 136 - } 137 - 138 - return valid; 139 - } 140 - 141 - static int user_handler(long rdi, long rsi, long rdx, long ursp, long r8, long r9, 142 - struct sgx_enclave_run *run) 143 - { 144 - run->user_data = 0; 145 - return 0; 146 - } 147 - 148 - int main(int argc, char *argv[]) 149 - { 150 - struct sgx_enclave_run run; 151 - struct vdso_symtab symtab; 152 - Elf64_Sym *eenter_sym; 153 - uint64_t result = 0; 110 + FIXTURE(enclave) { 154 111 struct encl encl; 112 + struct sgx_enclave_run run; 113 + }; 114 + 115 + FIXTURE_SETUP(enclave) 116 + { 117 + Elf64_Sym *sgx_enter_enclave_sym = NULL; 118 + struct vdso_symtab symtab; 119 + struct encl_segment *seg; 120 + char maps_line[256]; 121 + FILE *maps_file; 155 122 unsigned int i; 156 123 void *addr; 157 - int ret; 158 124 159 - memset(&run, 0, sizeof(run)); 160 - 161 - if (!encl_load("test_encl.elf", &encl)) { 162 - encl_delete(&encl); 125 + if (!encl_load("test_encl.elf", &self->encl)) { 126 + encl_delete(&self->encl); 163 127 ksft_exit_skip("cannot load enclaves\n"); 164 128 } 165 129 166 - if (!encl_measure(&encl)) 130 + for (i = 0; i < self->encl.nr_segments; i++) { 131 + seg = &self->encl.segment_tbl[i]; 132 + 133 + TH_LOG("0x%016lx 0x%016lx 0x%02x", seg->offset, seg->size, seg->prot); 134 + } 135 + 136 + if (!encl_measure(&self->encl)) 167 137 goto err; 168 138 169 - if (!encl_build(&encl)) 139 + if (!encl_build(&self->encl)) 170 140 goto err; 171 141 172 142 /* 173 143 * An enclave consumer only must do this. 174 144 */ 175 - for (i = 0; i < encl.nr_segments; i++) { 176 - struct encl_segment *seg = &encl.segment_tbl[i]; 145 + for (i = 0; i < self->encl.nr_segments; i++) { 146 + struct encl_segment *seg = &self->encl.segment_tbl[i]; 177 147 178 - addr = mmap((void *)encl.encl_base + seg->offset, seg->size, 179 - seg->prot, MAP_SHARED | MAP_FIXED, encl.fd, 0); 180 - if (addr == MAP_FAILED) { 181 - perror("mmap() segment failed"); 182 - exit(KSFT_FAIL); 183 - } 148 + addr = mmap((void *)self->encl.encl_base + seg->offset, seg->size, 149 + seg->prot, MAP_SHARED | MAP_FIXED, self->encl.fd, 0); 150 + EXPECT_NE(addr, MAP_FAILED); 151 + if (addr == MAP_FAILED) 152 + goto err; 184 153 } 185 - 186 - memset(&run, 0, sizeof(run)); 187 - run.tcs = encl.encl_base; 188 154 189 155 /* Get vDSO base address */ 190 156 addr = (void *)getauxval(AT_SYSINFO_EHDR); ··· 160 194 if (!vdso_get_symtab(addr, &symtab)) 161 195 goto err; 162 196 163 - eenter_sym = vdso_symtab_get(&symtab, "__vdso_sgx_enter_enclave"); 164 - if (!eenter_sym) 197 + sgx_enter_enclave_sym = vdso_symtab_get(&symtab, "__vdso_sgx_enter_enclave"); 198 + if (!sgx_enter_enclave_sym) 165 199 goto err; 166 200 167 - eenter = addr + eenter_sym->st_value; 201 + vdso_sgx_enter_enclave = addr + sgx_enter_enclave_sym->st_value; 168 202 169 - ret = sgx_call_vdso((void *)&MAGIC, &result, 0, EENTER, NULL, NULL, &run); 170 - if (!report_results(&run, ret, result, "sgx_call_vdso")) 171 - goto err; 203 + memset(&self->run, 0, sizeof(self->run)); 204 + self->run.tcs = self->encl.encl_base; 172 205 206 + maps_file = fopen("/proc/self/maps", "r"); 207 + if (maps_file != NULL) { 208 + while (fgets(maps_line, sizeof(maps_line), maps_file) != NULL) { 209 + maps_line[strlen(maps_line) - 1] = '\0'; 173 210 174 - /* Invoke the vDSO directly. */ 175 - result = 0; 176 - ret = eenter((unsigned long)&MAGIC, (unsigned long)&result, 0, EENTER, 177 - 0, 0, &run); 178 - if (!report_results(&run, ret, result, "eenter")) 179 - goto err; 211 + if (strstr(maps_line, "/dev/sgx_enclave")) 212 + TH_LOG("%s", maps_line); 213 + } 180 214 181 - /* And with an exit handler. */ 182 - run.user_handler = (__u64)user_handler; 183 - run.user_data = 0xdeadbeef; 184 - ret = eenter((unsigned long)&MAGIC, (unsigned long)&result, 0, EENTER, 185 - 0, 0, &run); 186 - if (!report_results(&run, ret, result, "user_handler")) 187 - goto err; 188 - 189 - printf("SUCCESS\n"); 190 - encl_delete(&encl); 191 - exit(KSFT_PASS); 215 + fclose(maps_file); 216 + } 192 217 193 218 err: 194 - encl_delete(&encl); 195 - exit(KSFT_FAIL); 219 + if (!sgx_enter_enclave_sym) 220 + encl_delete(&self->encl); 221 + 222 + ASSERT_NE(sgx_enter_enclave_sym, NULL); 196 223 } 224 + 225 + FIXTURE_TEARDOWN(enclave) 226 + { 227 + encl_delete(&self->encl); 228 + } 229 + 230 + #define ENCL_CALL(op, run, clobbered) \ 231 + ({ \ 232 + int ret; \ 233 + if ((clobbered)) \ 234 + ret = vdso_sgx_enter_enclave((unsigned long)(op), 0, 0, \ 235 + EENTER, 0, 0, (run)); \ 236 + else \ 237 + ret = sgx_enter_enclave((void *)(op), NULL, 0, EENTER, NULL, NULL, \ 238 + (run)); \ 239 + ret; \ 240 + }) 241 + 242 + #define EXPECT_EEXIT(run) \ 243 + do { \ 244 + EXPECT_EQ((run)->function, EEXIT); \ 245 + if ((run)->function != EEXIT) \ 246 + TH_LOG("0x%02x 0x%02x 0x%016llx", (run)->exception_vector, \ 247 + (run)->exception_error_code, (run)->exception_addr); \ 248 + } while (0) 249 + 250 + TEST_F(enclave, unclobbered_vdso) 251 + { 252 + struct encl_op op; 253 + 254 + op.type = ENCL_OP_PUT; 255 + op.buffer = MAGIC; 256 + 257 + EXPECT_EQ(ENCL_CALL(&op, &self->run, false), 0); 258 + 259 + EXPECT_EEXIT(&self->run); 260 + EXPECT_EQ(self->run.user_data, 0); 261 + 262 + op.type = ENCL_OP_GET; 263 + op.buffer = 0; 264 + 265 + EXPECT_EQ(ENCL_CALL(&op, &self->run, false), 0); 266 + 267 + EXPECT_EQ(op.buffer, MAGIC); 268 + EXPECT_EEXIT(&self->run); 269 + EXPECT_EQ(self->run.user_data, 0); 270 + } 271 + 272 + TEST_F(enclave, clobbered_vdso) 273 + { 274 + struct encl_op op; 275 + 276 + op.type = ENCL_OP_PUT; 277 + op.buffer = MAGIC; 278 + 279 + EXPECT_EQ(ENCL_CALL(&op, &self->run, true), 0); 280 + 281 + EXPECT_EEXIT(&self->run); 282 + EXPECT_EQ(self->run.user_data, 0); 283 + 284 + op.type = ENCL_OP_GET; 285 + op.buffer = 0; 286 + 287 + EXPECT_EQ(ENCL_CALL(&op, &self->run, true), 0); 288 + 289 + EXPECT_EQ(op.buffer, MAGIC); 290 + EXPECT_EEXIT(&self->run); 291 + EXPECT_EQ(self->run.user_data, 0); 292 + } 293 + 294 + static int test_handler(long rdi, long rsi, long rdx, long ursp, long r8, long r9, 295 + struct sgx_enclave_run *run) 296 + { 297 + run->user_data = 0; 298 + 299 + return 0; 300 + } 301 + 302 + TEST_F(enclave, clobbered_vdso_and_user_function) 303 + { 304 + struct encl_op op; 305 + 306 + self->run.user_handler = (__u64)test_handler; 307 + self->run.user_data = 0xdeadbeef; 308 + 309 + op.type = ENCL_OP_PUT; 310 + op.buffer = MAGIC; 311 + 312 + EXPECT_EQ(ENCL_CALL(&op, &self->run, true), 0); 313 + 314 + EXPECT_EEXIT(&self->run); 315 + EXPECT_EQ(self->run.user_data, 0); 316 + 317 + op.type = ENCL_OP_GET; 318 + op.buffer = 0; 319 + 320 + EXPECT_EQ(ENCL_CALL(&op, &self->run, true), 0); 321 + 322 + EXPECT_EQ(op.buffer, MAGIC); 323 + EXPECT_EEXIT(&self->run); 324 + EXPECT_EQ(self->run.user_data, 0); 325 + } 326 + 327 + TEST_HARNESS_MAIN
+2 -2
tools/testing/selftests/sgx/main.h
··· 35 35 bool encl_measure(struct encl *encl); 36 36 bool encl_build(struct encl *encl); 37 37 38 - int sgx_call_vdso(void *rdi, void *rsi, long rdx, u32 function, void *r8, void *r9, 39 - struct sgx_enclave_run *run); 38 + int sgx_enter_enclave(void *rdi, void *rsi, long rdx, u32 function, void *r8, void *r9, 39 + struct sgx_enclave_run *run); 40 40 41 41 #endif /* MAIN_H */
+17 -2
tools/testing/selftests/sgx/test_encl.c
··· 4 4 #include <stddef.h> 5 5 #include "defines.h" 6 6 7 + static uint8_t encl_buffer[8192] = { 1 }; 8 + 7 9 static void *memcpy(void *dest, const void *src, size_t n) 8 10 { 9 11 size_t i; ··· 16 14 return dest; 17 15 } 18 16 19 - void encl_body(void *rdi, void *rsi) 17 + void encl_body(void *rdi, void *rsi) 20 18 { 21 - memcpy(rsi, rdi, 8); 19 + struct encl_op *op = (struct encl_op *)rdi; 20 + 21 + switch (op->type) { 22 + case ENCL_OP_PUT: 23 + memcpy(&encl_buffer[0], &op->buffer, 8); 24 + break; 25 + 26 + case ENCL_OP_GET: 27 + memcpy(&op->buffer, &encl_buffer[0], 8); 28 + break; 29 + 30 + default: 31 + break; 32 + } 22 33 }
+2 -1
tools/testing/selftests/sgx/test_encl.lds
··· 18 18 .text : { 19 19 *(.text*) 20 20 *(.rodata*) 21 + FILL(0xDEADBEEF); 22 + . = ALIGN(4096); 21 23 } : text 22 24 23 - . = ALIGN(4096); 24 25 .data : { 25 26 *(.data*) 26 27 } : data
+98 -21
tools/testing/selftests/splice/short_splice_read.sh
··· 1 1 #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Test for mishandling of splice() on pseudofilesystems, which should catch 5 + # bugs like 11990a5bd7e5 ("module: Correctly truncate sysfs sections output") 6 + # 7 + # Since splice fallback was removed as part of the set_fs() rework, many of these 8 + # tests expect to fail now. See https://lore.kernel.org/lkml/202009181443.C2179FB@keescook/ 3 9 set -e 4 10 11 + DIR=$(dirname "$0") 12 + 5 13 ret=0 14 + 15 + expect_success() 16 + { 17 + title="$1" 18 + shift 19 + 20 + echo "" >&2 21 + echo "$title ..." >&2 22 + 23 + set +e 24 + "$@" 25 + rc=$? 26 + set -e 27 + 28 + case "$rc" in 29 + 0) 30 + echo "ok: $title succeeded" >&2 31 + ;; 32 + 1) 33 + echo "FAIL: $title should work" >&2 34 + ret=$(( ret + 1 )) 35 + ;; 36 + *) 37 + echo "FAIL: something else went wrong" >&2 38 + ret=$(( ret + 1 )) 39 + ;; 40 + esac 41 + } 42 + 43 + expect_failure() 44 + { 45 + title="$1" 46 + shift 47 + 48 + echo "" >&2 49 + echo "$title ..." >&2 50 + 51 + set +e 52 + "$@" 53 + rc=$? 54 + set -e 55 + 56 + case "$rc" in 57 + 0) 58 + echo "FAIL: $title unexpectedly worked" >&2 59 + ret=$(( ret + 1 )) 60 + ;; 61 + 1) 62 + echo "ok: $title correctly failed" >&2 63 + ;; 64 + *) 65 + echo "FAIL: something else went wrong" >&2 66 + ret=$(( ret + 1 )) 67 + ;; 68 + esac 69 + } 6 70 7 71 do_splice() 8 72 { 9 73 filename="$1" 10 74 bytes="$2" 11 75 expected="$3" 76 + report="$4" 12 77 13 - out=$(./splice_read "$filename" "$bytes" | cat) 78 + out=$("$DIR"/splice_read "$filename" "$bytes" | cat) 14 79 if [ "$out" = "$expected" ] ; then 15 - echo "ok: $filename $bytes" 80 + echo " matched $report" >&2 81 + return 0 16 82 else 17 - echo "FAIL: $filename $bytes" 18 - ret=1 83 + echo " no match: '$out' vs $report" >&2 84 + return 1 19 85 fi 20 86 } 21 87 ··· 89 23 { 90 24 filename="$1" 91 25 26 + echo " checking $filename ..." >&2 27 + 92 28 full=$(cat "$filename") 29 + rc=$? 30 + if [ $rc -ne 0 ] ; then 31 + return 2 32 + fi 33 + 93 34 two=$(echo "$full" | grep -m1 . | cut -c-2) 94 35 95 36 # Make sure full splice has the same contents as a standard read. 96 - do_splice "$filename" 4096 "$full" 37 + echo " splicing 4096 bytes ..." >&2 38 + if ! do_splice "$filename" 4096 "$full" "full read" ; then 39 + return 1 40 + fi 97 41 98 42 # Make sure a partial splice see the first two characters. 99 - do_splice "$filename" 2 "$two" 43 + echo " splicing 2 bytes ..." >&2 44 + if ! do_splice "$filename" 2 "$two" "'$two'" ; then 45 + return 1 46 + fi 47 + 48 + return 0 100 49 } 101 50 102 - # proc_single_open(), seq_read() 103 - test_splice /proc/$$/limits 104 - # special open, seq_read() 105 - test_splice /proc/$$/comm 51 + ### /proc/$pid/ has no splice interface; these should all fail. 52 + expect_failure "proc_single_open(), seq_read() splice" test_splice /proc/$$/limits 53 + expect_failure "special open(), seq_read() splice" test_splice /proc/$$/comm 106 54 107 - # proc_handler, proc_dointvec_minmax 108 - test_splice /proc/sys/fs/nr_open 109 - # proc_handler, proc_dostring 110 - test_splice /proc/sys/kernel/modprobe 111 - # proc_handler, special read 112 - test_splice /proc/sys/kernel/version 55 + ### /proc/sys/ has a splice interface; these should all succeed. 56 + expect_success "proc_handler: proc_dointvec_minmax() splice" test_splice /proc/sys/fs/nr_open 57 + expect_success "proc_handler: proc_dostring() splice" test_splice /proc/sys/kernel/modprobe 58 + expect_success "proc_handler: special read splice" test_splice /proc/sys/kernel/version 113 59 60 + ### /sys/ has no splice interface; these should all fail. 114 61 if ! [ -d /sys/module/test_module/sections ] ; then 115 - modprobe test_module 62 + expect_success "test_module kernel module load" modprobe test_module 116 63 fi 117 - # kernfs, attr 118 - test_splice /sys/module/test_module/coresize 119 - # kernfs, binattr 120 - test_splice /sys/module/test_module/sections/.init.text 64 + expect_failure "kernfs attr splice" test_splice /sys/module/test_module/coresize 65 + expect_failure "kernfs binattr splice" test_splice /sys/module/test_module/sections/.init.text 121 66 122 67 exit $ret
+9 -1
tools/testing/selftests/timers/rtcpie.c
··· 18 18 #include <stdlib.h> 19 19 #include <errno.h> 20 20 21 + #include "../kselftest.h" 22 + 21 23 /* 22 24 * This expects the new RTC class driver framework, working with 23 25 * clocks that will often not be clones of what the PC-AT had. ··· 37 35 switch (argc) { 38 36 case 2: 39 37 rtc = argv[1]; 40 - /* FALLTHROUGH */ 38 + break; 41 39 case 1: 40 + fd = open(default_rtc, O_RDONLY); 41 + if (fd == -1) { 42 + printf("Default RTC %s does not exist. Test Skipped!\n", default_rtc); 43 + exit(KSFT_SKIP); 44 + } 45 + close(fd); 42 46 break; 43 47 default: 44 48 fprintf(stderr, "usage: rtctest [rtcdev] [d]\n");