Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid to use ENV:TERM in the regression tests. #1969

Closed
zimmerle opened this issue Nov 30, 2018 · 3 comments
Closed

Avoid to use ENV:TERM in the regression tests. #1969

zimmerle opened this issue Nov 30, 2018 · 3 comments
Assignees
Labels
3.x Related to ModSecurity version 3.x

Comments

@zimmerle
Copy link
Contributor

A while ago there was a discussion on the developer and packagers mailing lists [1] [2] about the utilization of the environment variable TERM as part of a regression test. The objective of the test was to certify that ModSecurity was capable to read environment vars via the ENV variable.

Turns out, TERM wasn't a good variable as it is not set is some use cases, for instance, while generating packages in a build environment, leading the tests to fail.

In order to circumvent the problem @airween suggested to set the variable before start the test process, which was indeed a very good idea. However, it was still possible that other persons hit the same problem. Occasionally @inittab bought up the discussion again, because he hit the same problem as @ariween.

To have a more wide solution the ENV test case was changed to read a variable that is set by the regression test client. That way nobody will face this problem again :)

Test case:
https://github.com/SpiderLabs/ModSecurity/blob/25bb1f1bcc7252e93bd42067cac23a07b71fb8b9/test/test-cases/regression/variable-ENV.json#L46-L89

Change in the regression utility:
https://github.com/SpiderLabs/ModSecurity/blob/25bb1f1bcc7252e93bd42067cac23a07b71fb8b9/test/regression/regression.cc#L428-L431

In addition a new test case was created using setenv action:
https://github.com/SpiderLabs/ModSecurity/blob/25bb1f1bcc7252e93bd42067cac23a07b71fb8b9/test/test-cases/regression/variable-ENV.json#L90-L134

zimmerle pushed a commit that referenced this issue Nov 30, 2018
@zimmerle
Copy link
Contributor Author

@zimmerle zimmerle self-assigned this Nov 30, 2018
@zimmerle zimmerle added the 3.x Related to ModSecurity version 3.x label Nov 30, 2018
@airween
Copy link
Member

airween commented Dec 5, 2018

Sorry to tell you, but building of ModSecurity v.3.0.3 in sbuild is failed:

make  check-TESTS
make[3]: Entering directory '/<<PKGBUILDDIR>>'
make[4]: Entering directory '/<<PKGBUILDDIR>>'
(   0/  0/   0): test/test-cases/regression/issue-1785.json
(   0/  0/   0): test/test-cases/regression/issue-1850.json
(   0/  0/   0): test/test-cases/regression/issue-1844.json
(   0/  0/   0): test/test-cases/regression/issue-1725.json
...
(   0/  0/   0): test/test-cases/secrules-language-tests/operators/ge.json
(   0/  0/   0): test/test-cases/secrules-language-tests/operators/lt.json
(   0/  0/   0): test/test-cases/secrules-language-tests/operators/ipMatch.json
============================================================================
Testsuite summary for modsecurity 3.0
============================================================================
# TOTAL: 0
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

When I make the package in native shell, then tests successfully finished:

make  check-TESTS
make[3]: Entering directory '/home/airween/tmp/modsec_201812051050/modsecurity-3.0.3'
make[4]: Entering directory '/home/airween/tmp/modsec_201812051050/modsecurity-3.0.3'
(   1/  0/   1): test/test-cases/regression/issue-1812.json
(   1/  0/   1): test/test-cases/regression/issue-1850.json
(   1/  0/   1): test/test-cases/regression/issue-1785.json
(   3/  0/   3): test/test-cases/regression/issue-1591.json
...
(  12/  0/  12): test/test-cases/secrules-language-tests/operators/lt.json
(  32/  0/  32): test/test-cases/secrules-language-tests/operators/validateUtf8Encoding.json
(3623/  0/3623): test/test-cases/secrules-language-tests/operators/ipMatch.json
============================================================================
Testsuite summary for modsecurity 3.0
============================================================================
# TOTAL: 4799
# PASS:  4795
# SKIP:  4
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================

This issue affects only ModSecurity v3.0.3, from releases page.

To track the issue is very hard in sbuild environment - do you have any idea, what do I need to see?

@airween
Copy link
Member

airween commented Dec 6, 2018

Solved - the pkg-config package is needed to build, and sbuild doesn't contain it by default.

Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Related to ModSecurity version 3.x
Projects
None yet
Development

No branches or pull requests

2 participants