1. 05 2月, 2016 1 次提交
    • C
      Test Result: define a formal method to register test result classes · 6ee69b27
      Cleber Rosa 提交于
      Avocado defines avocado.core.result.TestResult, so that alternative
      test result classes can inherit from it. When a user writes a new
      test result class, he's left wondering how to activate that.
      
      First, for consistency, Avocado should define proper interfaces
      for "test result plugins". This is on sight, and will ultimately
      allow users to register new test result implementations simply by
      registering the setuptools entry points, just as it's currently
      done (on versions >= 0.31.0) for command line related plugins.
      
      Until then, let's at least improve the current state of things.
      These changes believe that the following improvements are given here:
      
      * avocado.core.job.Job._set_output_plugins now won't look at every
        possible key in the application arguments, and won't silence
        possible errors while trying to instantiate test result classes.
      * test result writers can now use a documented method for registering
        their test result classes.
      
      The same approach was not chosen to be done with the test runner
      classes because there can only by one test runner per Avocado job.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      6ee69b27
  2. 04 2月, 2016 1 次提交
  3. 03 2月, 2016 2 次提交
  4. 29 1月, 2016 1 次提交
    • C
      avocado.main(): avoid an infinite fork loop bomb · 08103fb4
      Cleber Rosa 提交于
      Because the current implementation of avocado.main() creates a job
      and runs "sys.argv[0]" to implement standalone mode, it ends up
      running itself over and over.
      
      This simple proposed fix, prevents avocado.main() from running
      itself again if called from itself. Since they are on different
      processes, the mechanism chosen to do this is to set an environment
      variable, that will be seen by the next process.
      
      Also, by exiting from main() with an error code, the test first
      level test will fail. This will let the user know that the chosen
      approach (SIMPLE tests written in Python and calling main()) are
      not worthy of a PASS.
      
      The functional tests make use of Python's standard library utilities
      (subprocess module) directly for running Avocado because of current
      issues with Avocado's own process utility module.
      
      This adresses issue #961.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      08103fb4
  5. 27 1月, 2016 3 次提交
    • L
      avocado.utils.service: Use sudo if a command requires root · 3654551e
      Lucas Meneghel Rodrigues 提交于
      Instead of assuming we have administrative privileges to
      run service manager related commands, use sudo in commands
      that do require root. We now assume you're running the
      test as a user that has sudo configuration such that no
      password will be prompted to execute that command [1].
      
      A place where we need such a provision is when running on
      Amazon AWS instances (we can't run as root, but the base
      user of the image has the appropriate sudo configuration).
      
      [1] Running as root means that sudo won't be necessary,
      but figuring that out is responsibility of the process
      APIs, that were modified to take a sudo parameter and
      figure things out based on that.
      Signed-off-by: NLucas Meneghel Rodrigues <lookkas@gmail.com>
      3654551e
    • L
      avocado.utils.process: Add 'sudo' parameter to run and system APIs · 7dad50e7
      Lucas Meneghel Rodrigues 提交于
      Some commands do require admin privileges to run, but we
      can't use the 'root' user in some testing scenarios [1].
      
      So let's add a 'sudo' parameter to process.run(), process.system()
      and process.system_output() interfaces, that will append
      a sudo command to the original command string, causing it
      to be executed under sudo. The basic assumption here is
      that the user executing the tests was added to the sudoers
      file in such a way that it can run administrative commands
      without a password.
      
      [1] One specific environment where we can't use the root
      user is when avocado runs on an AWS (Amazon Web Services)
      instance.
      Signed-off-by: NLucas Meneghel Rodrigues <lookkas@gmail.com>
      7dad50e7
    • A
      avocado.core: show the subcommand help on unknown argparse option · 6cd03d6f
      Amador Pahim 提交于
      Using an unknown option in a given subcommand leads argparse to
      show the main avocado usage instructions.
      
      This patch makes the argparse show the subcommand help instead.
      
      Also, argparse error exit code now matches error_codes.AVOCADO_FAIL,
      which makes more sense than error_codes.AVOCADO_JOB_FAIL.
      
      Reference:https://trello.com/c/o0TpH9aeSigned-off-by: NAmador Pahim <apahim@redhat.com>
      6cd03d6f
  6. 26 1月, 2016 1 次提交
  7. 21 1月, 2016 1 次提交
  8. 20 1月, 2016 1 次提交
  9. 19 1月, 2016 1 次提交
  10. 16 1月, 2016 1 次提交
  11. 13 1月, 2016 1 次提交
    • C
      loader: make test methods unique when discovering tests · f86e7dad
      Cleber Rosa 提交于
      As per report on issue #952, Avocado currently finds multiple tests
      when multiple test names exist in a given Python class. When the
      test code itself is loaded and the test class instantiated, only
      one test method will remain (others will have been overloaded by
      that one).
      
      So, to mimic this in the static, AST based, test discovery, let's
      make the test methods unique and try to keep the order in which the
      AST parser found them.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      f86e7dad
  12. 07 1月, 2016 2 次提交
    • C
      selftests/functional/test_basic.py: remove references to old Plugin · c4180e95
      Cleber Rosa 提交于
      There are a few leftover references to the old Plugin classes in
      the functional tests. Let's remove them.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      c4180e95
    • L
      avocado.core.loader: Append test directory to sys.path · 62ae0d60
      Lucas Meneghel Rodrigues 提交于
      If a test has local imports (a fairly common use case),
      we have to append the base test dir to sys.path. Otherwise,
      we end up having a horrible traceback as a result:
      
      Exception loading test
      Traceback (most recent call last):
        File "/home/lmr/Code/avocado.lmr/avocado/core/runner.py", line 200, in _run_test
          instance = loader.load_test(test_factory)
        File "/home/lmr/Code/avocado.lmr/avocado/core/loader.py", line 262, in load_test
          test_module = imp.load_module(module_name, f, p, d)
        File "scylla_longevity.py", line 5, in <module>
          from sdcm.tester import ScyllaClusterTester
      ImportError: No module named sdcm.tester
      
      Which is clearly not wanted. We had this problem before
      and now we have a regression. It's time for a functional
      test to make sure we don't regress again.
      Signed-off-by: NLucas Meneghel Rodrigues <lookkas@gmail.com>
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      62ae0d60
  13. 04 1月, 2016 1 次提交
  14. 28 12月, 2015 1 次提交
    • C
      Pseudo terminals: add utility module · 003bfaed
      Cleber Rosa 提交于
      Based on previous experiences (GDB terminal redirection attempts),
      it's common for applications that need to allocate a pseudo to have
      the name of the allocated file. This is, unfortunately, something that
      the Python standard library doesn't give for free.
      
      This simple utility module wraps and extends the Python standard
      library `pty` module, providing a `openpty` function that, besides
      allocating the pseudo terminal, also returns its name.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      003bfaed
  15. 18 12月, 2015 16 次提交
  16. 16 12月, 2015 1 次提交
  17. 15 12月, 2015 1 次提交
    • C
      selftests/functional/test_output.py: skip test on absence of PIL library · 5f7bafd0
      Cleber Rosa 提交于
      The `test_gendata` test of `OutputTest` runs the example test
      `gendata.py`, but the `gendata.py` itself has a conditional in one of
      the tests that make use of the PIL (aka Pillow package) library and
      does nothing if it's missing.
      
      PIL (Pillow) is highly dependent on C compilers and libraries to be
      able to build itself. This makes systems it harder to run the full
      Avocado self tests on more diverse (usually minimalist) systems.
      
      So, let's make that functional test optional, if the libraries are not
      present.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      5f7bafd0
  18. 11 12月, 2015 1 次提交
    • C
      Human output: functional test fixes · cb4b6d97
      Cleber Rosa 提交于
      There are a couple of functional unittests that assume that a given
      output was produced by the regular UI, that is, the Human output
      format.
      
      That is fine, since they're functional tests. But, some situations
      lead to test errors, instead of pointing failures. Let's turn those
      into explicit checks and fail properly instead of producing errors.
      
      Note: These errors were visible when the human output was disabled, in
      the plugin overhaul work, but the fixes still make sense independently
      of that work.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      cb4b6d97
  19. 07 12月, 2015 1 次提交
    • C
      virtualenv: allow tests to run properly on them · 63aa6df6
      Cleber Rosa 提交于
      While going through the dependency list (requirements*.txt files) and
      performing our self tests out of virtual environments, I noticed that
      some tests are run outside the virtual environments.
      
      The reason is that, even though the virtual environment is activated
      for the test session (and say, `which python` gives `/venv/bin/python`),
      we have hard coded `/usr/bin/python` in most places.
      
      According to the some discussions on the virtualenv project itself[1],
      a quick solution is to revert to the also common `/usr/bin/env python`
      way of pointing to the Python interpreter.
      
      [1] - https://github.com/pypa/virtualenv/issues/124Signed-off-by: NCleber Rosa <crosa@redhat.com>
      63aa6df6
  20. 03 12月, 2015 2 次提交