vmojzis / tests / selinux

Forked from tests/selinux 4 years ago
Clone

1d45ca7 checkmodule/checkmodule: Grep for error messages rather than debug logs

Authored and Committed by plautrba 5 years ago
    checkmodule/checkmodule: Grep for error messages rather than debug logs
    
    checkpolicy was updated in 2.9 in order not to write debug messages on ouput. It
    doesn't output "loading policy ..." messages anymore.
    
    At the same time, it should be enough to check the checkmodule exit status and
    whether the OUTPUT_FILE exists
    
    See https://github.com/SELinuxProject/selinux/commit/854fdc1ac40720782491e8ada6837aa4550a7ca1
    
    Fixes:
    [   PASS   ] :: Command 'checkmodule >& /tmp/tmp.GUkhm09UGI' (Expected 1, got 1)
    [   FAIL   ] :: File '/tmp/tmp.GUkhm09UGI' should contain 'loading policy configuration from policy.conf'
    [   PASS   ] :: Command 'checkmodule -b >& /tmp/tmp.GUkhm09UGI' (Expected 1, got 1)
    [   FAIL   ] :: File '/tmp/tmp.GUkhm09UGI' should contain 'loading policy configuration from policy'
    [  BEGIN   ] :: Running 'checkmodule -m -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*loading policy configuration from mypolicy.te"'
    [   FAIL   ] :: Command 'checkmodule -m -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*loading policy configuration from mypolicy.te"' (Expected 0, got 1)
    [  BEGIN   ] :: Running 'checkmodule -m -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*writing binary representation.*to mypolicy.output"'
    [   FAIL   ] :: Command 'checkmodule -m -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*writing binary representation.*to mypolicy.output"' (Expected 0, got 1)
    [  BEGIN   ] :: Running 'checkmodule -m -C -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*loading policy configuration from mypolicy.te"'
    [   FAIL   ] :: Command 'checkmodule -m -C -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*loading policy configuration from mypolicy.te"' (Expected 0, got 1)
    [  BEGIN   ] :: Running 'checkmodule -m -C -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*writing CIL to mypolicy.output"'
    [   FAIL   ] :: Command 'checkmodule -m -C -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*writing CIL to mypolicy.output"' (Expected 0, got 1)