Re: regression testing & python2

Dan Langille <[email protected]> Tue, 5 Oct 2021 11:21:46 -0400
Newsgroups gmane.comp.sysutils.backup.bacula.devel
Message-ID <[email protected]>
Dan Langille wrote:
>
> Hello,
>
> Is it time to update the regression tests from Python 2 to Python3?
>
> e.g.
>
> [pg14 dan ~/src/bacula/regress] % grep -r python2 * 14:25:49
> build/release/bgit.py:#!/usr/bin/env python2
> test_duration:#!/usr/bin/env python2
> ^C
>
> This is not a complete list.
>


I have started moving my regression testing hosts from 9.x to 11.x and 
I'm finding things which need improvement.

Following on from this, I am finding other things which are breaking 
regression testing on non-Linux systems.

The first: do not assume /bin/bash exists

[pg14 dan ~/src/bacula/regress] % git diff 
scripts/cleanup                                       15:11:00
diff --git a/regress/scripts/cleanup b/regress/scripts/cleanup
index 6cc332a16..fbeb28025 100755
--- a/regress/scripts/cleanup
+++ b/regress/scripts/cleanup
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Copyright (C) 2000-2020 Kern Sibbald
# License: BSD 2-Clause; see file LICENSE-FOSS
[pg14 dan ~/src/bacula/regress] 
%                                                                15:11:07

This same problem also affects regress/scripts/regress-utils.sh

Next, do not assume /bin/bash is the bash you are using. On some 
systems, it is /usr/local/bin/bash.

Deeper into regress/scripts/regress-utils.sh, is found:

# now check if we are running under a proper shell
if test "x$SHELL" != "x/bin/bash"
then
   echo "Regression script must use BASH for this utilities!"
   exit 1
fi

This will fail on my system for sure and others I'm sure.  I think for 
two reasons:

1 - $SHELL is an environment variable - it is not the shell running this 
script
2 - bash is not always /bin/bash

Must I be running the bash shell to invoke regression testing? If so, why?

Regression testing is vital to the project. At present, regression will 
work only on a limited number of operating systems.

I'm hoping we can change that soon.

I'm happy to send in pull requests soon.

_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel