1. 23 4月, 2018 2 次提交
  2. 21 4月, 2018 3 次提交
    • C
      FDDrainer: pass text to loggers · e1b21e2d
      Cleber Rosa 提交于
      The FDDrainer reads from process output and write to loggers.  The
      test log, which is intended for humans, can indeed try to treat it as
      text.  The stream logger, on the other hand, should deal with data as
      binary content *only*, but this will be handled on a future change.
      
      By having text content passed to the loggers, we avoid the occurrence
      of log lines that look like:
      
        [stdout] b'command output'
      
      Or output files (job-YYYY-MM-DDTHH.MM-id/tests/<test>/output) that
      may literally contain:
      
        b'command output'
      
      The encoding used is the one specified at the command execution.  With
      this fix, a number of tests on Python 3 can now run successfully.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      e1b21e2d
    • C
      selftests/functional/test_basic.py: make echo output safe · 6a104b45
      Cleber Rosa 提交于
      In the module global scope, "man echo" is executed to attempt to
      determine if it's a GNU echo.  But, "man echo" in a locale such
      as UTF-8 produces funky copyright characters:
      
        $ LANG=en_US.UTF-8 man echo | chardetect -
        <stdin>: windows-1252 with confidence 0.73
      
      Which can not be decoded by the UTF-8 codec, producing
      UnicodeDecodeErrors.  Even if that wasn't the case, it's better to
      control the locale of command that can generate varied output, and
      that we depend on.
      
        $ LANG=C man echo | chardetect -
        <stdin>: ascii with confidence 1.0
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      6a104b45
    • C
      avocado.utils.process: require commands to be given as unicode strings · 1401f3cf
      Cleber Rosa 提交于
      This change introduces the following requirement: the command to
      be run by the avocado.utils.process functions should be given as unicode.
      It brings a clearer interface, in which there's no need to deal with
      encodings internally.
      
      For simple test, it brings changes to respect the of passing unicode.
      And, it changes the presentation of simple tests with unicode names
      explicitly expreseed as such.
      
      The way to deal with the process data that may be generated on
      stdout/stderr is unchanged.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      1401f3cf
  3. 19 4月, 2018 1 次提交
  4. 18 4月, 2018 1 次提交
    • C
      Travis-CI: skip tests that are time/resource sensitive · 822095d5
      Cleber Rosa 提交于
      And that have been causing failures on Travis jobs, due to limited
      on unreliable amount of resources present.
      
      This is the full list of tests that won't be run anymore on Travis,
      only on `make check-full`:
      
        selftests.functional.test_basic.RunnerOperationTest.test_early_latest_result
        selftests.functional.test_basic.RunnerSimpleTest.test_kill_stopped_sleep
        selftests.functional.test_interrupt.InterruptTest.test_well_behaved_sigint
        selftests.functional.test_interrupt.InterruptTest.test_well_behaved_sigterm
        selftests.functional.test_loader.LoaderTestFunctional.test_simple_using_main
        selftests.functional.test_loader.LoaderTestFunctional.test_sleep_a_lot
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      822095d5
  5. 11 4月, 2018 1 次提交
  6. 28 3月, 2018 3 次提交
  7. 22 3月, 2018 1 次提交
  8. 20 3月, 2018 1 次提交
    • C
      Travis-CI: whitelist style check errors · aadb1c9a
      Cleber Rosa 提交于
      The latest jobs have been failing because of the following issues:
      
          ************* Module raise
          E1130: 48,30: Raise.test: bad operand type for unary -: NoneType
          ************* Module selftests.functional.test_basic
          I1101:1191,24: PluginsXunitTest.run_and_check: Module 'lxml.etree'
          has not 'XMLSchema' member, but source is unavailable. Consider
          adding this module to extension-pkg-whitelist if you want to
          perform analysis based on run-time introspection of living
          objects.
          I1101:1191,40: PluginsXunitTest.run_and_check: Module 'lxml.etree'
          has not 'parse' member, but source is unavailable. Consider adding
          this module to extension-pkg-whitelist if you want to perform
          analysis based on run-time introspection of living objects.
          I1101:1193,43: PluginsXunitTest.run_and_check: Module 'lxml.etree'
          has not 'parse' member, but source is unavailable. Consider adding
          this module to extension-pkg-whitelist if you want to perform
          analysis based on run-time introspection of living objects.
          ************* Module selftests.unit.test_xunit
          I1101: 91,24: xUnitSucceedTest.test_add_success: Module
          'lxml.etree' has not 'XMLSchema' member, but source is
          unavailable. Consider adding this module to
          extension-pkg-whitelist if you want to perform analysis based on
          run-time introspection of living objects.
          I1101: 91,40: xUnitSucceedTest.test_add_success: Module
          'lxml.etree' has not 'parse' member, but source is
          unavailable. Consider adding this module to
          extension-pkg-whitelist if you want to perform analysis based on
          run-time introspection of living objects.
          I1101: 92,43: xUnitSucceedTest.test_add_success: Module
          'lxml.etree' has not 'parse' member, but source is
          unavailable. Consider adding this module to
          extension-pkg-whitelist if you want to perform analysis based on
          run-time introspection of living objects.
      
      We can't whitelist the `lxml.etree` module at this time (inspekt doesn't
      have such an option) and the raise failure is a false positive.  Let's
      ignore those issues then.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      aadb1c9a
  9. 15 3月, 2018 1 次提交
    • C
      Python 3: load JSON as supported on 3.4 (and earlier) · d2b4edc3
      Cleber Rosa 提交于
      Under Python 3.4, which runs on our CI and is our lowest supported
      version, json.loads() requires a string, while newer versions also
      allows bytes.
      
          >>> json.loads(b'{}')
          Traceback (most recent call last):
            File "<stdin>", line 1, in <module>
            File "/home/cleber/.local/lib/python3.4/json/__init__.py", line 312, in loads s.__class__.__name__))
          TypeError: the JSON object must be str, not 'bytes'
      
      Let's make that code compatible with Python 3.4.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      d2b4edc3
  10. 23 2月, 2018 1 次提交
  11. 22 2月, 2018 5 次提交
  12. 16 2月, 2018 1 次提交
    • C
      avocado.utils.process: use bytes for raw stdout/stderr · 7d0e6a44
      Cleber Rosa 提交于
      This brings a change in behaviour, in which the stdout/stderr of the
      executed process will now be of bytes type, instead of a string type.
      
      Two new attributes, which are implemented as properties, have been
      added to the CmdResult class, `stdout_text` and `stderr_text`.  Those
      are convenience methods that will return the same content that is in
      `stdout` and `stderr`, reespectively, but decoded on the fly[1].
      
      With regards to encoding, if one is not provided, the result of
      `sys.getdefaultencoding()` will be used ("utf-8" for Python 3 and
      "ascii" for Python 2).
      
      Applications and/or tests using the APIs that return a CmdResult
      should, to the best of my knowledge, set a default encoding themselves
      so a stable behavior across Python versions.  But that if left to
      users of this API.
      
      A different tradeoff/design decision has to do with the tests modified
      here.  One option is to have "text" (as in sequences of human readable
      glyphs) as being of Python type "str".  On Python 2, "str" can be
      compared to "bytes" because a conversion will happen on demand.  That
      is, the following is fine on Python 2:
      
         >>> result = process.run("command")
         >>> "expected" in process.stdout
      
      Where `expected` is of type "str" and `process.stdout` is of type
      "bytes".  This is not true of Python 3, so either the types must match
      or a conversion must be done explicitly.  The solutions to that are:
      
      1) have these "text" as (of type) "bytes" in the source code itself,
         and avoid the conversion whenever possible
      2) have "strings" in the source code itself, and use the conversion
         provided by `CmdResult.stdout_text` and `CmdResult.stderr_text`.
      
      The approach chosen here is to avoid conversion if possible, that is,
      use "byte" types, given the fact that the source code encoding is by
      default 'ascii' and most of the "text" dealt with here can be
      represented in 'ascii' too.  This is equivalent of doing:
      
         result = process.run("command")
         b"expected" in process.stdout
         "errors: %s" % 0 in process.stderr_text
      
      [1] The obvious alternative, instead of decoding these on the fly
          would be to have multiple copies of the "same" data.  This assumes
          that binary data produced on the stdout/stderr will usually be
          larger than textual data.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      7d0e6a44
  13. 15 2月, 2018 2 次提交
  14. 12 2月, 2018 2 次提交
  15. 10 2月, 2018 1 次提交
    • A
      SIMPLE tests: improve status API · c42bfbc9
      Amador Pahim 提交于
      Currently simple tests have a limited status API, being able to set only
      the WARN status by generating an output string in a very specific and
      hard-coded format.
      
      This patch, while respects the current behaviour, creates configuration
      keys, allowing users to provide regular expressions to search for in the
      test outputs, aiming to set the final test status to either WARN or SKIP
      when the test finishes with exit code 0.
      Signed-off-by: NAmador Pahim <apahim@redhat.com>
      c42bfbc9
  16. 14 12月, 2017 1 次提交
  17. 06 12月, 2017 1 次提交
  18. 15 11月, 2017 1 次提交
  19. 13 10月, 2017 1 次提交
  20. 11 10月, 2017 1 次提交
  21. 03 10月, 2017 2 次提交
  22. 15 9月, 2017 1 次提交
    • L
      selftests: Make sure to use correct basedir · c4dcff6d
      Lukáš Doktor 提交于
      The basedir was mainly set correctly, but sometimes not used in some of
      the tests. Let's move the `os.chdir` to `setUp` phase where it makes
      sense and add new ones where they were not present.
      
      Related to basedir the test_mux was using hardcoded path based on the
      method used to execute the test, let's change it to `__file__` which
      gives better results.
      Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
      c4dcff6d
  23. 24 8月, 2017 1 次提交
    • C
      Removal of "import magic" for avocado and avocado-rest-client · d39f9a0a
      Cleber Rosa 提交于
      These scripts rely on some Python library path manipulation to be
      able to load from the source tree.  But, in fact that are a few
      reasons for not having those, including:
      
       * All functionality in `avocado` relies on plugins, which will not be
         available from the source tree unless a `$ setup.py develop` is
         executed, which automatically makes the "import magic" unnecessary.
      
       * Most users will end up using a setuptools generated "entry point"
         instead.
      
      For the sake of less code, I propose this (and all other?) magic to be
      removed.
      Signed-off-by: NCleber Rosa <crosa@redhat.com>
      d39f9a0a
  24. 16 8月, 2017 1 次提交
  25. 14 8月, 2017 1 次提交
  26. 11 8月, 2017 1 次提交
  27. 06 8月, 2017 2 次提交