New issue
Advanced search Search tips

Issue 769031 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

can't upload autotest or code review

Project Member Reported by xiaochu@chromium.org, Sep 26 2017

Issue description

Outside of chroot, typing in 'repo upload . --current-branch':

Errors in PROJECT *chromiumos/third_party/autotest*!
    COMMIT 3053a06e:
        Description:
            >autotest/platform_AddPrinter: avoid UI navigation
            >
            >It avoids UI navigation all tegether. It uses debugd to add printer and
            >verify its success. It uses dbus-send to download component.
            >
            >BUG=chromium:764411
            >TEST=test on DuT
            >
            >Change-Id: I3c6941c4b5dff3f93f1725bce73067fe8f41d32a
            >
            >
        Errors:
            * Hook script "./utils/run_pylint.py" failed with code 1:
              Traceback (most recent call last):
                File "./utils/run_pylint.py", line 450, in <module>
                  main()
                File "./utils/run_pylint.py", line 443, in main
                  pylint_base_opts)
                File "./utils/run_pylint.py", line 368, in check_committed_files
                  batch_check_files(temp_files, pylint_base_opts)
                File "./utils/run_pylint.py", line 217, in batch_check_files
                  exit=False)
                File "/usr/lib/python2.7/dist-packages/pylint/lint.py", line 1333, in __init__
                  linter.check(args)
                File "/usr/lib/python2.7/dist-packages/pylint/lint.py", line 755, in check
                  self._do_check(files_or_modules)
                File "/usr/lib/python2.7/dist-packages/pylint/lint.py", line 886, in _do_check
                  self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
                File "/usr/lib/python2.7/dist-packages/pylint/lint.py", line 967, in check_astroid_module
                  walker.walk(ast_node)
                File "/usr/lib/python2.7/dist-packages/pylint/utils.py", line 959, in walk
                  self.walk(child)
                File "/usr/lib/python2.7/dist-packages/pylint/utils.py", line 956, in walk
                  cb(astroid)
                File "./utils/run_pylint.py", line 152, in visit_from
                  return super(CustomVariablesChecker, self).visit_from(node)
              AttributeError: 'super' object has no attribute 'visit_from'
              
            * Hook script "./bin/test_lucifer" failed with code 1:
              Traceback (most recent call last):
                File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
                  "__main__", fname, loader, pkg_name)
                File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
                  exec code in run_globals
                File "/usr/local/google/home/xiaochu/chromiumos/infra_virtualenv/venv/cros_venv/scripts/create_venv.py", line 46, in <module>
                  main()
                File "/usr/local/google/home/xiaochu/chromiumos/infra_virtualenv/venv/cros_venv/scripts/create_venv.py", line 35, in main
                  print(venv.ensure())
                File "/usr/local/google/home/xiaochu/chromiumos/infra_virtualenv/venv/cros_venv/venvlib.py", line 99, in ensure
                  self._check_or_create()
                File "/usr/local/google/home/xiaochu/chromiumos/infra_virtualenv/venv/cros_venv/venvlib.py", line 107, in _check_or_create
                  self._create()
                File "/usr/local/google/home/xiaochu/chromiumos/infra_virtualenv/venv/cros_venv/venvlib.py", line 116, in _create
                  logfile=logfile)
                File "/usr/local/google/home/xiaochu/chromiumos/infra_virtualenv/venv/cros_venv/venvlib.py", line 207, in _create_venv
                  _log_check_call(command, logfile=logfile)
                File "/usr/local/google/home/xiaochu/chromiumos/infra_virtualenv/venv/cros_venv/venvlib.py", line 229, in wrapped_command
                  call_func(args, stdout=logfile, **kwargs)
                File "/usr/lib/python2.7/subprocess.py", line 181, in check_call
                  retcode = call(*popenargs, **kwargs)
                File "/usr/lib/python2.7/subprocess.py", line 168, in call
                  return Popen(*popenargs, **kwargs).wait()
                File "/usr/lib/python2.7/subprocess.py", line 390, in __init__
                  errread, errwrite)
                File "/usr/lib/python2.7/subprocess.py", line 1024, in _execute_child
                  raise child_exception
              OSError: [Errno 2] No such file or directory
              ERROR: Failed to set up a virtualenv.
              

Preupload failed due to errors in project(s). HINTS:
- To disable some source style checks, and for other hints, see <checkout_dir>/src/repohooks/README
- To upload only current project, run 'repo upload .'
 
Status: WontFix (was: Untriaged)
works in chroot.
Cc: achuith@chromium.org
Status: Untriaged (was: WontFix)
I'm seeing the same error.

I develop outside the chroot, and would prefer to invoke repo upload outside the chroot. This has been working until recently.

What's the reason this cannot be fixed?
Components: Infra>Client>ChromeOS
Cc: ayatane@chromium.org
The first error looks like you have a bad version of pylint installed locally.  That's why you need to run in the chroot.  Otherwise, you are on your own for fixing your working environment.

The second error is a dupe of https://bugs.chromium.org/p/chromium/issues/detail?id=767678, make sure you have a full and up to date repo checkout.
I'm seeing the first error, and I have some new lucifer error (but I've never expected test_lucifer to work -- I have a knee-jerk '--no-verify' at this point). Pylint is whatever Rodete is shipping:

$ pylint --version
pylint.py 1.4.1, 
astroid 1.3.4, common 0.63.2
Python 2.7.13 (default, Nov 24 2017, 17:33:09) 
[GCC 6.3.0 20170516]


autotest is the only project that persistently barfs on running its presubmits outside the chroot. Would still be nice to get this fixed...
The presubmits should work outside the chroot, the chroot is just a way to ensure your environment isn't the thing breaking them.  It sounds like something about your environment is breaking them; what, I do not know.  If you can provide an example that I can reproduce, then I can look into it.

Can you post the new lucifer error?  There are only two issues left that I am aware of, you need to run build_externals.py (which cannot be shared inside vs outside the chroot) and you need to install virtualenv.
Hmm, I don't know what changed, but pylint is no longer failing. Could build_externals.py be related there too? I think I'm even checking out the exact same CLs that wouldn't run earlier...

For test_lucifer (ignore the pylint errors; they're preexisting "legit" errors):

Errors in PROJECT *chromiumos/third_party/autotest*!                                                     
    COMMIT db02f7bc:
        Description:
            >power_SuspendStress: use 'interface' library
            >
            >We don't need to reimplement the 'is_up' check.
            >
            >BUG=chromium:814442
            >TEST=power_SuspendStress with cable removed and 'check_connection'
            >     forced on
            >
            >Change-Id: I7b8c6f59529ecc6a718b86a1127a2c85e44e9a00
            >Signed-off-by: Brian Norris <briannorris@chromium.org>
            >
            >
        Errors:
            * Hook script "./utils/run_pylint.py" failed with code 1:
              ************* Module power_SuspendStress
              C: 59, 4: Missing method docstring (missing-docstring)
              C: 89, 4: Missing method docstring (missing-docstring)
              
              ------------------------------------------------------------------
              Your code has been rated at 9.73/10 (previous run: 9.73/10, +0.00)
              
              ERROR:root:16
              
            * Hook script "./bin/test_lucifer" failed with code 2:
              ============================= test session starts ==============================
              platform linux2 -- Python 2.7.13, pytest-3.1.3, py-1.4.34, pluggy-0.4.0
              rootdir: /usr/local/google/home/briannorris/chromiumos/src/third_party/autotest/files/venv, inifile: pytest.ini
              plugins: catchlog-1.2.2, cov-2.5.1
              collected 24 items / 2 errors
              
              
              ---------- coverage: platform linux2, python 2.7.13-final-0 ----------
              Name                               Stmts   Miss Branch BrPart  Cover   Missing
              ------------------------------------------------------------------------------
              lucifer/autotest.py                   73     42      6      0    39%   49-50, 57-66, 72-108, 117-120, 135-139, 142, 149-154, 164, 174, 184-186, 196-198
              lucifer/autotest_unittest.py          32     17      0      0    47%   23-26, 37-39, 47-51, 56-58, 66-70, 78-82
              lucifer/cmd/job_aborter.py            76     49     18      0    29%   56-70, 74-82, 98-107, 115-117, 125-127, 134, 143-145, 153-154, 167-168, 181-185, 189, 193, 197
              lucifer/cmd/job_reporter.py           60     36      2      0    39%   51-67, 75-80, 89-93, 98-103, 119-128, 133-136, 140, 144
              lucifer/cmd/test/abort_socket.py      15      5      0      0    67%   28-32
              lucifer/eventlib.py                   37     19      2      0    46%   75-81, 92-97, 106-112
              lucifer/eventlib_unittest.py          42     24      0      0    43%   17-33, 38-47, 52-57, 62-67, 72-74, 83, 86, 93, 96
              lucifer/handlers.py                  126     99     34      0    17%   41-45, 48-55, 59, 63, 66-77, 80-81, 85-95, 98-107, 110-116, 124-131, 140-143, 149-159, 163-176, 180, 188-200, 205-210
              lucifer/handoffs.py                   44     29      8      0    29%   32-38, 49-59, 63-68, 73-82, 90-94
              lucifer/jobx.py                       31     22      8      0    23%   26, 34-35, 46-49, 59-63, 76-80, 91-92, 100-103
              lucifer/leasing.py                    69     43      6      0    35%   43-48, 57-59, 74, 79, 91-100, 108-117, 128-135, 139-142, 147, 152, 160-168
              lucifer/leasing_unittest.py          116     82     10      0    27%   35-38, 44-47, 53-57, 63-68, 73-76, 81-84, 89-96, 101-107, 113-120, 126-134, 140-141, 157-173, 186-197, 202, 207, 216-219
              lucifer/loglib.py                     13      4      0      0    69%   22, 33-34, 43
              lucifer/loglib_unittest.py            19     19      0      0     0%   5-35
              ------------------------------------------------------------------------------
              TOTAL                                787    490     94      0    34%
              
              6 files skipped due to complete coverage.
              
              ==================================== ERRORS ====================================
              _________________ ERROR collecting lucifer/loglib_unittest.py __________________
              ../../../../../../.cache/cros_venv/venv-2.7.13-5e245727ed23dd962b0bb6d1c7a40f7d/local/lib/python2.7/site-packages/py/_path/local.py:680: in pyimport
                  raise self.ImportMismatchError(modname, modfile, self)
              E   ImportMismatchError: ('lucifer.loglib_unittest', '/mnt/host/source/src/third_party/autotest/files/venv/lucifer/loglib_unittest.py', local('/usr/local/google/home/briannorris/chromiumos/src/third_party/autotest/files/venv/lucifer/loglib_unittest.py'))
              _________________ ERROR collecting lucifer/loglib_unittest.py __________________
              import file mismatch:
              imported module 'lucifer.loglib_unittest' has this __file__ attribute:
                /mnt/host/source/src/third_party/autotest/files/venv/lucifer/loglib_unittest.py
              which is not the same as the test file we want to collect:
                /usr/local/google/home/briannorris/chromiumos/src/third_party/autotest/files/venv/lucifer/loglib_unittest.py
              HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
              !!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
              =========================== 2 error in 0.40 seconds ============================
              

Preupload failed due to errors in project(s). HINTS:
- To disable some source style checks, and for other hints, see <checkout_dir>/src/repohooks/README
- To upload only current project, run 'repo upload .'




Oh...but educated guesses (and the error about .pyc files) led me to try removing/re-checking out the 'venv' directory...and now it works.

I guess that means presubmits (at least, outside the chroot) are incompatible with running 'test_that --autotest_dir=$HOME/trunk/src/third_party/autotest/files/ ...'? Because that tends to leave .pyc files strewn about.

Comment 8 by nxia@chromium.org, Feb 22 2018

Cc: -ayatane@chromium.org
Owner: ayatane@chromium.org
assigning to ayatane@ to comment
re #7

In general, Python's pyc do not work across inside/outside chroot, since the absolute path changes.  I have considered always removing pyc before running unittests, but that introduces a performance penalty (having to recompile the pyc files every time).

https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/887358
Status: Fixed (was: Untriaged)

Sign in to add a comment