Message ID | 20200623123702.401338-2-omosnace@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | Various CI-related testsuite fixes | expand |
On Tue, Jun 23, 2020 at 8:37 AM Ondrej Mosnacek <omosnace@redhat.com> wrote: > > In Travis CI (Ubuntu), the shell used by Make doesn't understand > bashisms like [[ ... ]]. Replace them with plain [ ... ] and also break > up the conditionals for better readabilty. > > Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> When I ran into these issues (along with some similar problems with bashisms in some of the test scripts) in getting the testsuite to pass on Debian and Ubuntu, I addressed it by running dkpg-reconfigure dash and switching the default shell to bash (as noted in the README.md). Not objecting to changing it but just noting that there are further bashisms in the testsuite beyond the Makefiles. In any event, Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
On Tue, Jun 23, 2020 at 9:10 AM Stephen Smalley <stephen.smalley.work@gmail.com> wrote: > On Tue, Jun 23, 2020 at 8:37 AM Ondrej Mosnacek <omosnace@redhat.com> wrote: > > > > In Travis CI (Ubuntu), the shell used by Make doesn't understand > > bashisms like [[ ... ]]. Replace them with plain [ ... ] and also break > > up the conditionals for better readabilty. > > > > Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> > > When I ran into these issues (along with some similar problems with > bashisms in some of the test scripts) in getting the testsuite to pass > on Debian and Ubuntu, I addressed it by running dkpg-reconfigure dash > and switching the default shell to bash (as noted in the README.md). > Not objecting to changing it but just noting that there are further > bashisms in the testsuite beyond the Makefiles. Agreed. I don't think requiring bash is the same problem that it may have been ~20 years ago; it would be even easier if Ubuntu hadn't decided to go with dash (/me shakes fist). Regardless of this patch, I think it might be good to add a check to the test suite to warn (fail?) if the current shell is not bash.
diff --git a/policy/Makefile b/policy/Makefile index 672733e..6c49091 100644 --- a/policy/Makefile +++ b/policy/Makefile @@ -37,13 +37,15 @@ endif ifeq ($(SUPPORTS_CIL),y) CIL_TARGETS = test_mlsconstrain.cil test_overlay_defaultrange.cil -ifeq ($(shell [[ $(MAX_KERNEL_POLICY) -ge 32 && $(POL_VERS) -ge 32 ]] && echo true),true) +ifeq ($(shell [ $(MAX_KERNEL_POLICY) -ge 32 ] && echo true),true) +ifeq ($(shell [ $(POL_VERS) -ge 32 ] && echo true),true) # If other MLS tests get written this can be moved outside of the glblub test ifeq ($(POL_TYPE), MLS) CIL_TARGETS += test_glblub.cil else ifeq ($(POL_TYPE), MCS) CIL_TARGETS += test_add_levels.cil test_glblub.cil endif # POL_TYPE +endif # POL_VERS endif # MAX_KERNEL_POLICY endif # SUPPORTS_CIL diff --git a/tests/Makefile b/tests/Makefile index bdbdf3e..919335b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -68,9 +68,13 @@ ifeq ($(shell grep -q key_socket $(POLDEV)/include/support/all_perms.spt && test SUBDIRS += key_socket endif -ifeq ($(shell [[ $(MAX_KERNEL_POLICY) -ge 32 && ( $(POL_TYPE) == 'MLS' || $(POL_TYPE) == 'MCS' ) && $(POL_VERS) -ge 32 ]] && echo true),true) +ifeq ($(shell [ $(MAX_KERNEL_POLICY) -ge 32 ] && echo true),true) +ifeq ($(shell [ $(POL_TYPE) = 'MLS' ] || [ $(POL_TYPE) = 'MCS' ] && echo true),true) +ifeq ($(shell [ $(POL_VERS) -ge 32 ] && echo true),true) SUBDIRS += glblub -endif +endif # POL_VERS +endif # POL_TYPE +endif # MAX_KERNEL_POLICY ifeq ($(shell grep "^SELINUX_INFINIBAND_ENDPORT_TEST=" infiniband_endport/ibendport_test.conf | cut -d'=' -f 2),1) SUBDIRS += infiniband_endport
In Travis CI (Ubuntu), the shell used by Make doesn't understand bashisms like [[ ... ]]. Replace them with plain [ ... ] and also break up the conditionals for better readabilty. Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> --- policy/Makefile | 4 +++- tests/Makefile | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-)