Skip bash shell_integration tests if bash is a debug build

Switch to using BASH_VERSINFO rather than BASH_VERSION, since it
provides structured data.

    BASH_VERSINFO
           A readonly array variable whose members hold version information for this instance of bash.  The values assigned to the array members are as follows:
           BASH_VERSINFO[0]        The major version number (the release).
           BASH_VERSINFO[1]        The minor version number (the version).
           BASH_VERSINFO[2]        The patch level.
           BASH_VERSINFO[3]        The build version.
           BASH_VERSINFO[4]        The release status (e.g., beta1).
           BASH_VERSINFO[5]        The value of MACHTYPE.

When release status is not "release", bash builds are in debug mode and
output extra information which disturbs the integration.

Closes #5473
This commit is contained in:
James McCoy 2022-09-05 11:31:46 -04:00
parent 5bdf27fd78
commit f0d497dfe0
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB

View File

@ -25,10 +25,11 @@ def bash_ok():
v = shutil.which('bash') v = shutil.which('bash')
if not v: if not v:
return False return False
o = subprocess.check_output([v, '-c', 'echo "${BASH_VERSION}"']).decode('utf-8').strip() o = subprocess.check_output([v, '-c', 'echo "${BASH_VERSINFO[0]}\n${BASH_VERSINFO[4]}"']).decode('utf-8').strip()
if not o or int(o[0]) < 5: if not o:
return False return False
return True (major_ver, relstatus) = o.split(maxsplit=2)
return int(major_ver) >= 5 and relstatus == 'release'
def basic_shell_env(home_dir): def basic_shell_env(home_dir):
@ -240,7 +241,7 @@ function _set_status_prompt; function fish_prompt; echo -n "$pipestatus $status
pty.send_cmd_to_child('exit') pty.send_cmd_to_child('exit')
@unittest.skipUnless(bash_ok(), 'bash not installed or too old') @unittest.skipUnless(bash_ok(), 'bash not installed, too old, or debug build')
def test_bash_integration(self): def test_bash_integration(self):
ps1 = 'prompt> ' ps1 = 'prompt> '
with self.run_shell( with self.run_shell(