1. 31 1月, 2013 4 次提交
    • S
      ktest: Add make_warnings_file and process full warnings · 4283b169
      Steven Rostedt (Red Hat) 提交于
      Although the patchcheck test checks for warnings in the files that were
      changed, this check does not catch warnings that were caused by header
      file changes and the warnings appear in C files not touched by the
      commit.
      
      Add a new option called WARNINGS_FILE. If this option is set, then the
      file it points to is read before bulid, and the file should contain a
      list of known warnings. If a warning appears in the build, this file is
      checked, and if the warning does not exist in this file, then it fails
      the build showing the new warning.
      
      If the WARNINGS_FILE points to a file that does not exist, this will
      cause any warning in the build to fail.
      
      A new test is also added called "make_warnings_file". This test will
      create do a build and record any warnings it finds into the
      WARNINGS_FILE. This test is something that can be run before other tests
      to build a warnings file of "known warnings", ie, warnings that were
      there before your changes.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      4283b169
    • S
      ktest: Allow a test option to use its default option · 04262be3
      Steven Rostedt (Red Hat) 提交于
      Options are allowed to use other options, for example:
      
        LOG_FILE = ${OUTPUT_DIR}/${MACHINE}.log
      
      where the option LOG_FILE used the options OUTPUT_DIR and MACHINE.
      
      But if a test option were to use a default option, it will not get
      substituted:
      
        OUTPUT_DIR = ${THIS_DIR}/${MACHINE}
      
        TEST_START
        OUTPUT_DIR = ${OUTPUT_DIR}/t1
      
      For the above test, OUTPUT_DIR will stay literally "${OUTPUT_DIR}/t1"
      and not be converted to "${THIS_DIR}/${MACHINE}/t1". When the test runs,
      it will pass the ${OUTPUT_DIR} to the shell, which would probaly
      interpret it as "", and the output directory will end up as "/t1".
      
      Change the code where if a test option has its own option name in
      its defined field, and a default option exists, then substitute the
      default option in its place.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      04262be3
    • S
      ktest: Strip off '\n' when reading which files were modified · 35275685
      Steven Rostedt (Red Hat) 提交于
      The patchcheck test looks at what files are modified for each patch it
      checks and makes sure that those files do not produce any warnings.
      
      Unfortunately, when it read the diffstat, the newlines were added on the
      files and this made compares miss warnings, and commits that should not
      have passed, ktest let pass.
      
      Fix this by using the perl command "chomp" that strips off whitespace at
      the end of lines.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      35275685
    • S
      ktest: Do not require CONSOLE for build or install bisects · 319ab14f
      Steven Rostedt (Red Hat) 提交于
      If the user is doing a build or install bisect, there's no reason to
      have them define CONSOLE, as the console does not need to be read. The
      console only needs to be read for boot tests.
      
      CONSOLE is not required for normal build or install tests, let's not
      require it for bisect tests with BISECT_TYPE of build or install.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      319ab14f
  2. 05 1月, 2013 1 次提交
  3. 18 12月, 2012 8 次提交
  4. 12 12月, 2012 5 次提交
  5. 14 11月, 2012 1 次提交
    • S
      ktest: Add support for grub2 · a15ba913
      Steven Rostedt 提交于
      As only grub or 'script' is supported for rebooting to a new kernel,
      and Fedora 17 has dropped support for grub, I decided to add grub2
      support as well (I also plan on adding syslinux/extlinux support too).
      
      The options GRUB_FILE and GRUB_REBOOT were added to allow the user
      to specify where to find the grub.cfg and what tool to use to reboot
      into the next kernel respectively.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      a15ba913
  6. 09 11月, 2012 1 次提交
    • A
      revert "epoll: support for disabling items, and a self-test app" · a80a6b85
      Andrew Morton 提交于
      Revert commit 03a7beb5 ("epoll: support for disabling items, and a
      self-test app") pending resolution of the issues identified by Michael
      Kerrisk, copied below.
      
      We'll revisit this for 3.8.
      
      : I've taken a look at this patch as it currently stands in 3.7-rc1, and
      : done a bit of testing. (By the way, the test program
      : tools/testing/selftests/epoll/test_epoll.c does not compile...)
      :
      : There are one or two places where the behavior seems a little strange,
      : so I have a question or two at the end of this mail. But other than
      : that, I want to check my understanding so that the interface can be
      : correctly documented.
      :
      : Just to go though my understanding, the problem is the following
      : scenario in a multithreaded application:
      :
      : 1. Multiple threads are performing epoll_wait() operations,
      :    and maintaining a user-space cache that contains information
      :    corresponding to each file descriptor being monitored by
      :    epoll_wait().
      :
      : 2. At some point, a thread wants to delete (EPOLL_CTL_DEL)
      :    a file descriptor from the epoll interest list, and
      :    delete the corresponding record from the user-space cache.
      :
      : 3. The problem with (2) is that some other thread may have
      :    previously done an epoll_wait() that retrieved information
      :    about the fd in question, and may be in the middle of using
      :    information in the cache that relates to that fd. Thus,
      :    there is a potential race.
      :
      : 4. The race can't solved purely in user space, because doing
      :    so would require applying a mutex across the epoll_wait()
      :    call, which would of course blow thread concurrency.
      :
      : Right?
      :
      : Your solution is the EPOLL_CTL_DISABLE operation. I want to
      : confirm my understanding about how to use this flag, since
      : the description that has accompanied the patches so far
      : has been a bit sparse
      :
      : 0. In the scenario you're concerned about, deleting a file
      :    descriptor means (safely) doing the following:
      :    (a) Deleting the file descriptor from the epoll interest list
      :        using EPOLL_CTL_DEL
      :    (b) Deleting the corresponding record in the user-space cache
      :
      : 1. It's only meaningful to use this EPOLL_CTL_DISABLE in
      :    conjunction with EPOLLONESHOT.
      :
      : 2. Using EPOLL_CTL_DISABLE without using EPOLLONESHOT in
      :    conjunction is a logical error.
      :
      : 3. The correct way to code multithreaded applications using
      :    EPOLL_CTL_DISABLE and EPOLLONESHOT is as follows:
      :
      :    a. All EPOLL_CTL_ADD and EPOLL_CTL_MOD operations should
      :       should EPOLLONESHOT.
      :
      :    b. When a thread wants to delete a file descriptor, it
      :       should do the following:
      :
      :       [1] Call epoll_ctl(EPOLL_CTL_DISABLE)
      :       [2] If the return status from epoll_ctl(EPOLL_CTL_DISABLE)
      :           was zero, then the file descriptor can be safely
      :           deleted by the thread that made this call.
      :       [3] If the epoll_ctl(EPOLL_CTL_DISABLE) fails with EBUSY,
      :           then the descriptor is in use. In this case, the calling
      :           thread should set a flag in the user-space cache to
      :           indicate that the thread that is using the descriptor
      :           should perform the deletion operation.
      :
      : Is all of the above correct?
      :
      : The implementation depends on checking on whether
      : (events & ~EP_PRIVATE_BITS) == 0
      : This replies on the fact that EPOLL_CTL_AD and EPOLL_CTL_MOD always
      : set EPOLLHUP and EPOLLERR in the 'events' mask, and EPOLLONESHOT
      : causes those flags (as well as all others in ~EP_PRIVATE_BITS) to be
      : cleared.
      :
      : A corollary to the previous paragraph is that using EPOLL_CTL_DISABLE
      : is only useful in conjunction with EPOLLONESHOT. However, as things
      : stand, one can use EPOLL_CTL_DISABLE on a file descriptor that does
      : not have EPOLLONESHOT set in 'events' This results in the following
      : (slightly surprising) behavior:
      :
      : (a) The first call to epoll_ctl(EPOLL_CTL_DISABLE) returns 0
      :     (the indicator that the file descriptor can be safely deleted).
      : (b) The next call to epoll_ctl(EPOLL_CTL_DISABLE) fails with EBUSY.
      :
      : This doesn't seem particularly useful, and in fact is probably an
      : indication that the user made a logic error: they should only be using
      : epoll_ctl(EPOLL_CTL_DISABLE) on a file descriptor for which
      : EPOLLONESHOT was set in 'events'. If that is correct, then would it
      : not make sense to return an error to user space for this case?
      
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: "Paton J. Lewis" <palewis@adobe.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a80a6b85
  7. 26 10月, 2012 2 次提交
    • S
      ktest: Fix ktest confusion with CONFIG_MODULES_USE_ELF_RELA · 8bc5e4ea
      Steven Rostedt 提交于
      In order to decide if ktest should bother installing modules on the
      target box, it checks if the config file has CONFIG_MODULES=y. But it
      also checks if the '=y' part exists. It only will install modules if the
      config exists and is set with '=y'. But as the regex that was used
      tests:
      
        /^CONFIG_MODULES(=y)?/
      
      this will also match:
      
        CONFIG_MODULES_USE_ELF_RELA
      
      as the '=y' part was optional and it did not test the rest of the line.
      When this happens, ktest will stop checking the rest of the configs but
      it will also think that no modules are needed to be installed. What it
      should do is only jump out of the loop if it actually found a
      CONFIG_MODULES that is set to true.
      
      Otherwise, ktest wont install the necessary modules needed for proper
      booting of the test target.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8bc5e4ea
    • D
      tools/testing/selftests/epoll/test_epoll.c: fix build · fc314d0a
      Daniel Hazelton 提交于
      Latest Linus head run of "make selftests" in the tools directory failed
      with references to undefined variables.  Reference was to
      'write_thread_data' which is the name of a struct that is being used, not
      the variable itself.  Change reference so it points to the variable.
      Signed-off-by: NDaniel Hazelton <dshadowwolf@gmail.com>
      Cc: "Paton J. Lewis" <palewis@adobe.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fc314d0a
  8. 06 10月, 2012 1 次提交
  9. 28 9月, 2012 1 次提交
  10. 27 9月, 2012 1 次提交
    • S
      ktest: Fix ELSE IF statements · 95f57838
      Steven Rostedt 提交于
      The ELSE IF statements do not work as expected if another ELSE statement
      follows. This is because the $if_set is not set. If the ELSE IF
      condition is true, the following ELSE should be ignored. But because the
      $if_set is not set, the following ELSE will also be executed.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      95f57838
  11. 01 9月, 2012 1 次提交
  12. 01 8月, 2012 1 次提交
  13. 31 7月, 2012 4 次提交
    • A
      fault-injection: add tool to run command with failslab or fail_page_alloc · c24aa64d
      Akinobu Mita 提交于
      This adds tools/testing/fault-injection/failcmd.sh to run a command while
      injecting slab/page allocation failures via fault injection.
      
      Example:
      
      Run a command "make -C tools/testing/selftests/ run_tests" with
      injecting slab allocation failure.
      
      	# ./tools/testing/fault-injection/failcmd.sh \
      		-- make -C tools/testing/selftests/ run_tests
      
      Same as above except to specify 100 times failures at most instead of
      one time at most by default.
      
      	# ./tools/testing/fault-injection/failcmd.sh --times=100 \
      		-- make -C tools/testing/selftests/ run_tests
      
      Same as above except to inject page allocation failure instead of slab
      allocation failure.
      
      	# env FAILCMD_TYPE=fail_page_alloc \
      		./tools/testing/fault-injection/failcmd.sh --times=100 \
      		-- make -C tools/testing/selftests/ run_tests
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c24aa64d
    • A
      fault-injection: add selftests for cpu and memory hotplug · d89dffa9
      Akinobu Mita 提交于
      This adds two selftests
      
      * tools/testing/selftests/cpu-hotplug/on-off-test.sh is testing script
      for CPU hotplug
      
      1. Online all hot-pluggable CPUs
      2. Offline all hot-pluggable CPUs
      3. Online all hot-pluggable CPUs again
      4. Exit if cpu-notifier-error-inject.ko is not available
      5. Offline all hot-pluggable CPUs in preparation for testing
      6. Test CPU hot-add error handling by injecting notifier errors
      7. Online all hot-pluggable CPUs in preparation for testing
      8. Test CPU hot-remove error handling by injecting notifier errors
      
      * tools/testing/selftests/memory-hotplug/on-off-test.sh is doing the
      similar thing for memory hotplug.
      
      1. Online all hot-pluggable memory
      2. Offline 10% of hot-pluggable memory
      3. Online all hot-pluggable memory again
      4. Exit if memory-notifier-error-inject.ko is not available
      5. Offline 10% of hot-pluggable memory in preparation for testing
      6. Test memory hot-add error handling by injecting notifier errors
      7. Online all hot-pluggable memory in preparation for testing
      8. Test memory hot-remove error handling by injecting notifier errors
      Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
      Suggested-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Greg KH <greg@kroah.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <michael@ellerman.id.au>
      Cc: Dave Jones <davej@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d89dffa9
    • S
      ktest: Allow perl regex expressions in conditional statements · 8fddbe9b
      Steven Rostedt 提交于
      Add '=~' and '!~' to the list of allowed conditionals for DEFAULT and
      TEST_START section if statements.
      
      ie.
      
       TEST_START IF TEST =~ .*test$
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8fddbe9b
    • S
      ktest: Ignore errors it tests if IGNORE_ERRORS is set · 9b1d367d
      Steven Rostedt 提交于
      The option IGNORE_ERRORS is used to allow a test to succeed even if a
      warning appears from the kernel. Sometimes kernels will produce warnings
      that are not associated with a test, and the user wants to test
      something else.
      
      The IGNORE_ERRORS works for boot up, but was not preventing test runs to
      succeed if the kernel produced a warning.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      9b1d367d
  14. 21 7月, 2012 1 次提交
  15. 20 7月, 2012 7 次提交
    • S
      ktest: Add check for bug or panic during reboot · 8a80c727
      Steven Rostedt 提交于
      Usually the target is booted into a dependable kernel when a test
      starts. The test will install the test kernel and reboot the box. But
      there may be a time that the kernel is running an unreliable kernel and
      the reboot may crash.
      
      Have ktest detect crashes on a reboot and force a power-cycle instead.
      
      This can usually happen if a test kernel was installed to run manual
      tests, but the user forgot to reboot to the known good kernel.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8a80c727
    • S
      ktest: Add MAX_MONITOR_WAIT option · 407b95b7
      Steven Rostedt 提交于
      If the console is constantly outputting content, this can cause ktest
      to get stuck waiting on the monitor to settle down.
      
      The option MAX_MONITOR_WAIT is the maximum time (in seconds) for ktest
      to wait for the console to flush.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      407b95b7
    • S
      ktest: Fix config bisect with how make oldnoconfig works · cf79fab6
      Steven Rostedt 提交于
      With a name like 'oldnoconfig' one may think that the config generated
      would disable all configs that were not defined (selecting "no" for all
      options). But this is not the case. It selects the default. If a config
      has a 'default y', then it is added if not specified.
      
      This broke the config bisect, because options not specified by a config
      will just use the default, where it expected to turn off. This caused an
      option to be enabled that disabled an option that would break the build.
      The end result was that we never found the bad config at the end of the
      test.
      
      Instead of using 'make oldnoconfig', ktest now builds the options it
      expects enabled and disabled. When it turns off an option, it will no
      longer remove it, but actually set it to:
      
       # CONFIG_FOO is not set.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      cf79fab6
    • S
      ktest: Add CONFIG_BISECT_CHECK option · b0918612
      Steven Rostedt 提交于
      The config-bisect can take a bad config and bisect it down to find out
      what config actually breaks the config. But as all tests will apply a
      minconfig (defined by a user) to apply before booting, it is possible
      that the minconfig could actually make the bad config work (minconfigs
      can disable configs). The end result is that the config bisect test will
      not find a config that breaks. This can be rather frustrating to the
      user.
      
      The CONFIG_BISECT_CHECK option, when set to 1, will make sure that the
      bad config (with the minconfig applied) still fails before trying to
      bisect.
      
      And yes, I did get burned by this.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      b0918612
    • S
      ktest: Add PRE_INSTALL option · e5c2ec11
      Steven Rostedt 提交于
      Add the PRE_INSTALL option that will allow a user to specify a shell
      command to be executed before the install operation executes.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      e5c2ec11
    • S
      ktest: Add PRE/POST_KTEST and TEST options · 921ed4c7
      Steven Rostedt 提交于
      In order to let the user add commands before and after ktest runs, the
      PRE_KTEST and POST_KTEST options are defined. They hold shell commands
      that will execute befor ktest runs its first test, as well as when it
      completed its last test.
      
      The PRE_TEST and POST_TEST will be run befor and after (respectively)
      for a given test. They can either be global (done for all tests) or
      defined by a single test.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      921ed4c7
    • S
      ktest: Remove commented exit · 958d8435
      Steven Rostedt 提交于
      A debug 'exit' was left in ktest.pl. Remove it.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      958d8435
  16. 01 6月, 2012 1 次提交
    • C
      syscalls, x86: add __NR_kcmp syscall · d97b46a6
      Cyrill Gorcunov 提交于
      While doing the checkpoint-restore in the user space one need to determine
      whether various kernel objects (like mm_struct-s of file_struct-s) are
      shared between tasks and restore this state.
      
      The 2nd step can be solved by using appropriate CLONE_ flags and the
      unshare syscall, while there's currently no ways for solving the 1st one.
      
      One of the ways for checking whether two tasks share e.g.  mm_struct is to
      provide some mm_struct ID of a task to its proc file, but showing such
      info considered to be not that good for security reasons.
      
      Thus after some debates we end up in conclusion that using that named
      'comparison' syscall might be the best candidate.  So here is it --
      __NR_kcmp.
      
      It takes up to 5 arguments - the pids of the two tasks (which
      characteristics should be compared), the comparison type and (in case of
      comparison of files) two file descriptors.
      
      Lookups for pids are done in the caller's PID namespace only.
      
      At moment only x86 is supported and tested.
      
      [akpm@linux-foundation.org: fix up selftests, warnings]
      [akpm@linux-foundation.org: include errno.h]
      [akpm@linux-foundation.org: tweak comment text]
      Signed-off-by: NCyrill Gorcunov <gorcunov@openvz.org>
      Acked-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Pavel Emelyanov <xemul@parallels.com>
      Cc: Andrey Vagin <avagin@openvz.org>
      Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Glauber Costa <glommer@parallels.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Matt Helsley <matthltc@us.ibm.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Vasiliy Kulikov <segoon@openwall.com>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Valdis.Kletnieks@vt.edu
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d97b46a6