1 |
More than a year ago, I had my first occurrence of a package that |
2 |
refused to work when run as root: dev-db/mysql. This lead to the following |
3 |
block of code in the src_test block: |
4 |
|
5 |
if [[ $UID -eq 0 ]]; then |
6 |
die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root." |
7 |
fi |
8 |
|
9 |
The latest package to fall into the same trap is dev-util/git. With testcases |
10 |
that are designed as expected failures, but pass when run as root, and the |
11 |
testsuite says that the package is broken thusly. |
12 |
|
13 |
setup: |
14 |
# mkdir d && |
15 |
# touch d/f && |
16 |
# chmod a-x d |
17 |
expected failure test: |
18 |
# stat d/f |
19 |
|
20 |
Having the if/die structure in src_test however is ugly, as if you are testing |
21 |
lots of packages, and you miss it, then you get mucked over. I think that there |
22 |
are also other packages that NEED root to run their tests due to kernel |
23 |
interaction (audit, cpu affinity iirc). |
24 |
|
25 |
Does anybody have suggestions on a better way of enforcing user/root for |
26 |
src_test, instead of having a nasty die structure? |
27 |
|
28 |
-- |
29 |
Robin Hugh Johnson |
30 |
Gentoo Linux Developer & Infra Guy |
31 |
E-Mail : robbat2@g.o |
32 |
GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85 |