MFC after: 1 week
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
pkg already provides tests. Should we leverage those instead of having another set of different tests?
Do all of these tests require root permissions to function?
| usr.sbin/pkg/tests/pkg_test.sh | ||
|---|---|---|
| 10–11 | One of these values should be removed (the latter statement is a no-op since the variable is already set). | |
| 16 | TIL! | |
| 50 | This only works when MK_RESCUE != no. The test should confirm that /rescue/sh exists before executing with atf_set require.files /rescue/sh. | |
| 60–75 | Same thing with less escaping :). | |
| 104–119 | ||
| 130 | A sysctl needs to be tested before we can confirm that jail functionality can be accessed, right? Also, I would assume that this would only work for root, not other users. | |
| 136–138 | General comment: I feel like there needs to be a generic "create test jail" script for procedures like this. | |
| usr.sbin/pkg/tests/pkg_test.sh | ||
|---|---|---|
| 10–11 | You assume the sysctl command always succeeds and returns a non-empty string. | |
| usr.sbin/pkg/tests/pkg_test.sh | ||
|---|---|---|
| 130 | No other tests that I know of do so. Why would jail functionality not be available? We've supported nested jails for over a decade. | |
| usr.sbin/pkg/tests/pkg_test.sh | ||
|---|---|---|
| 10–11 |
If that's the intent, the above code should use :- instead of := and it seems deserving of a comment. | |
| usr.sbin/pkg/tests/pkg_test.sh | ||
|---|---|---|
| 10–11 | That won't work. | |
| usr.sbin/pkg/tests/pkg_test.sh | ||
|---|---|---|
| 10–11 |
Why? :- sets the value if the variable evaluates to an empty string, which can occur if it's unset/undefined (the latter is not possible in this case). % : ${FOO=bar}
% : ${FOO=baz}
% echo ${FOO}
bar
% echo ${SHELL}
/bin/zsh | |
| usr.sbin/pkg/tests/pkg_test.sh | ||
|---|---|---|
| 10–11 | Your example works because it does not use :-. | |
| usr.sbin/pkg/tests/pkg_test.sh | ||
|---|---|---|
| 10–11 |
Yeah. That was a dumb example. Is there ever a scenario where the first case (calling sysctl) could fail? | |
| usr.sbin/pkg/tests/pkg_test.sh | ||
|---|---|---|
| 10–11 |
Ignore this question: I was messing up my shell variable expansion operators := vs = vs :-. | |
