1. 14 3月, 2015 1 次提交
    • M
      selftests: Introduce minimal shared logic for running tests · 5e29a910
      Michael Ellerman 提交于
      This adds a Make include file which most selftests can then include to
      get the run_tests logic.
      
      On its own this has the advantage of some reduction in repetition, and
      also means the pass/fail message is defined in fewer places.
      
      However the key advantage is it will allow us to implement install very
      simply in a subsequent patch.
      
      The default implementation just executes each program in $(TEST_PROGS).
      
      We use a variable to hold the default implementation of $(RUN_TESTS)
      because that gives us a clean way to override it if necessary, ie. using
      override. The mount, memory-hotplug and mqueue tests use that to provide
      a different implementation.
      
      Tests are not run via /bin/bash, so if they are scripts they must be
      executable, we add a+x to several.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NShuah Khan <shuahkh@osg.samsung.com>
      5e29a910
  2. 07 6月, 2014 1 次提交
    • K
      tools/testing/selftests/sysctl: validate sysctl_writes_strict · 24fe831c
      Kees Cook 提交于
      This adds several behavioral tests to sysctl string and number writing
      to detect unexpected cases that behaved differently when the sysctl
      kernel.sysctl_writes_strict != 1.
      
      [ original ]
          root@localhost:~# make test_num
          == Testing sysctl behavior against /proc/sys/kernel/domainname ==
          Writing test file ... ok
          Checking sysctl is not set to test value ... ok
          Writing sysctl from shell ... ok
          Resetting sysctl to original value ... ok
          Writing entire sysctl in single write ... ok
          Writing middle of sysctl after synchronized seek ... FAIL
          Writing beyond end of sysctl ... FAIL
          Writing sysctl with multiple long writes ... FAIL
          Writing entire sysctl in short writes ... FAIL
          Writing middle of sysctl after unsynchronized seek ... ok
          Checking sysctl maxlen is at least 65 ... ok
          Checking sysctl keeps original string on overflow append ... FAIL
          Checking sysctl stays NULL terminated on write ... ok
          Checking sysctl stays NULL terminated on overwrite ... ok
          make: *** [test_num] Error 1
          root@localhost:~# make test_string
          == Testing sysctl behavior against /proc/sys/vm/swappiness ==
          Writing test file ... ok
          Checking sysctl is not set to test value ... ok
          Writing sysctl from shell ... ok
          Resetting sysctl to original value ... ok
          Writing entire sysctl in single write ... ok
          Writing middle of sysctl after synchronized seek ... FAIL
          Writing beyond end of sysctl ... FAIL
          Writing sysctl with multiple long writes ... ok
          make: *** [test_string] Error 1
      
      [ with CONFIG_PROC_SYSCTL_STRICT_WRITES ]
          root@localhost:~# make run_tests
          == Testing sysctl behavior against /proc/sys/kernel/domainname ==
          Writing test file ... ok
          Checking sysctl is not set to test value ... ok
          Writing sysctl from shell ... ok
          Resetting sysctl to original value ... ok
          Writing entire sysctl in single write ... ok
          Writing middle of sysctl after synchronized seek ... ok
          Writing beyond end of sysctl ... ok
          Writing sysctl with multiple long writes ... ok
          Writing entire sysctl in short writes ... ok
          Writing middle of sysctl after unsynchronized seek ... ok
          Checking sysctl maxlen is at least 65 ... ok
          Checking sysctl keeps original string on overflow append ... ok
          Checking sysctl stays NULL terminated on write ... ok
          Checking sysctl stays NULL terminated on overwrite ... ok
          == Testing sysctl behavior against /proc/sys/vm/swappiness ==
          Writing test file ... ok
          Checking sysctl is not set to test value ... ok
          Writing sysctl from shell ... ok
          Resetting sysctl to original value ... ok
          Writing entire sysctl in single write ... ok
          Writing middle of sysctl after synchronized seek ... ok
          Writing beyond end of sysctl ... ok
          Writing sysctl with multiple long writes ... ok
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      24fe831c