Bug 1265934 - test_main and test_python failed
test_main and test_python failed
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: hawkey (Show other bugs)
7.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: packaging-team-maint
Desktop QE
: Extras
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-24 03:54 EDT by Tomas Pelka
Modified: 2016-03-01 04:06 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-03-01 04:06:06 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Tomas Pelka 2015-09-24 03:54:04 EDT
Description of problem:
685-The following tests FAILED:
686-      1 - test_main (Failed)
687-      2 - test_python (Failed)
688-Errors while running CTest
689:make: *** [test] Error 8
690:error: Bad exit status from /var/tmp/rpm-tmp.x2d2Ez (%check)
691-
692-
693-RPM build errors:


1: 99%: Checks: 187, Failures: 1, Errors: 0
1: /usr/src/redhat/BUILD/hawkey-git-0.202b194/tests/test_sack.c:43:F:Core:test_environment:0: Failure 'geteuid() == 0' occured
1/2 Test #1: test_main ........................***Failed    0.14 sec
test 2
    Start 2: test_python


======================================================================
2: FAIL: test_creation_dir (tests.test_sack.BasicTest)
2: ----------------------------------------------------------------------
2: Traceback (most recent call last):
2:   File "/usr/src/redhat/BUILD/hawkey-git-0.202b194/tests/python/tests/test_sack.py", line 67, in test_creation_dir
2:     self.assertFalse(os.access(sack.cache_dir, os.F_OK))
2: AssertionError: True is not false
2: 
2: ----------------------------------------------------------------------
2: XML: xunit.xml
2: ----------------------------------------------------------------------
2: Ran 137 tests in 0.077s
2: 
2: FAILED (failures=1)
2: Traceback (most recent call last):
2:   File "/usr/src/redhat/BUILD/hawkey-git-0.202b194/tests/python/tests/run_nosetests", line 23, in <module>
2:     env=childenv)
2:   File "/usr/lib64/python2.7/subprocess.py", line 542, in check_call
2:     raise CalledProcessError(retcode, cmd)
2: subprocess.CalledProcessError: Command '['nosetests-2.7', '--with-xunit', '--xunit-file=xunit.xml', '-s', '-v', '/usr/src/redhat/BUILD/hawkey-git-0.202b194/tests/python/tests']' returned non-zero exit status 1
2/2 Test #2: test_python ......................***Failed    0.62 sec

0% tests passed, 2 tests failed out of 2

Version-Release number of selected component (if applicable):
hawkey-0.5.8-2.git.0.202b194.el7

How reproducible:
100%

Steps to Reproduce:
1. builf hawkey
2.
3.

Actual results:
two tests failed

Expected results:
all tests should pass

Additional info:
full build log at http://nest.test.redhat.com/mnt/qa/scratch/ibm-p8-03-lp8/2015:20887/tps/hawkey-0.5.8-2.git.0.202b194.el7.src.rpm-ppc64le-rebuild.log

not arch specific
Comment 1 Nishidha 2015-11-28 03:37:19 EST
(In reply to Tomas Pelka from comment #0)
> Description of problem:
> 685-The following tests FAILED:
> 686-      1 - test_main (Failed)
> 687-      2 - test_python (Failed)
> 688-Errors while running CTest
> 689:make: *** [test] Error 8
> 690:error: Bad exit status from /var/tmp/rpm-tmp.x2d2Ez (%check)
> 691-
> 692-
> 693-RPM build errors:
> 
> 
> 1: 99%: Checks: 187, Failures: 1, Errors: 0
> 1:
> /usr/src/redhat/BUILD/hawkey-git-0.202b194/tests/test_sack.c:43:F:Core:
> test_environment:0: Failure 'geteuid() == 0' occured
> 1/2 Test #1: test_main ........................***Failed    0.14 sec
> test 2
>     Start 2: test_python
> 
> 
> ======================================================================
> 2: FAIL: test_creation_dir (tests.test_sack.BasicTest)
> 2: ----------------------------------------------------------------------
> 2: Traceback (most recent call last):
> 2:   File
> "/usr/src/redhat/BUILD/hawkey-git-0.202b194/tests/python/tests/test_sack.py",
> line 67, in test_creation_dir
> 2:     self.assertFalse(os.access(sack.cache_dir, os.F_OK))
> 2: AssertionError: True is not false
> 2: 
> 2: ----------------------------------------------------------------------
> 2: XML: xunit.xml
> 2: ----------------------------------------------------------------------
> 2: Ran 137 tests in 0.077s
> 2: 
> 2: FAILED (failures=1)
> 2: Traceback (most recent call last):
> 2:   File
> "/usr/src/redhat/BUILD/hawkey-git-0.202b194/tests/python/tests/
> run_nosetests", line 23, in <module>
> 2:     env=childenv)
> 2:   File "/usr/lib64/python2.7/subprocess.py", line 542, in check_call
> 2:     raise CalledProcessError(retcode, cmd)
> 2: subprocess.CalledProcessError: Command '['nosetests-2.7', '--with-xunit',
> '--xunit-file=xunit.xml', '-s', '-v',
> '/usr/src/redhat/BUILD/hawkey-git-0.202b194/tests/python/tests']' returned
> non-zero exit status 1
> 2/2 Test #2: test_python ......................***Failed    0.62 sec
> 
> 0% tests passed, 2 tests failed out of 2
> 
> Version-Release number of selected component (if applicable):
> hawkey-0.5.8-2.git.0.202b194.el7
> 
> How reproducible:
> 100%
> 
> Steps to Reproduce:
> 1. builf hawkey
> 2.
> 3.
> 
> Actual results:
> two tests failed
> 
> Expected results:
> all tests should pass
> 
> Additional info:
> full build log at
> http://nest.test.redhat.com/mnt/qa/scratch/ibm-p8-03-lp8/2015:20887/tps/
> hawkey-0.5.8-2.git.0.202b194.el7.src.rpm-ppc64le-rebuild.log
> 
> not arch specific


Hello Tomas,

I too had got same failures on RHEL 7.1 ppc64le as well as x86. After investigating the issue, I could find a fix for this problem.
If you look at the failure in test_main, it fails because geteuid() returns 0. It returns 0 for root users. The test case has a comment saying it works only for regular users. And it has a check at the beginning which makes the test case to fail if euid (Effective User ID) is 0.

Solution: 
a. Creating a non-root user and login using it. 
b. Provide read/write access to .log files inside “hawkey-0.5.6/build/Testing/Temporary” if it throws any error like “Permission denied”.
c. Run make test

For me, all the tests passed after this. Even test_python passes, if you've all its dependencies like nose and flask are installed.

Let me know if this solution works for you.

Thanks,
Nishidha
Comment 2 Michal Domonkos 2016-03-01 04:06:06 EST
Hey Tom,

Nishidha is correct; you have to build hawkey as a regular user (not root).  It will work then (I just tried).

I'm closing this BZ.

Note You need to log in before you can comment on or make changes to this bug.