~apport-hackers/apport/+git/apport-old:journal-errors-window

Last commit made on 2022-05-17
Get this branch:
git clone -b journal-errors-window https://git.launchpad.net/~apport-hackers/apport/+git/apport-old
Members of Apport upstream developers can upload to this branch. Log in for directions.

Branch merges

Branch information

Name:
journal-errors-window
Repository:
lp:~apport-hackers/apport/+git/apport-old

Recent commits

40b1733... by Brian Murray

Grab a slice of JournalErrors around the crash time instead of 1000 lines

014b25a... by Benjamin Drung

test: Skip local dpkg diversions

`test_get_file_package_diversion` fails on the GitHub CI in the Ubuntu
container, because the first line of `dpkg-divert` is a local diversion:

```
$ dpkg-divert --list
local diversion of /sbin/initctl to /sbin/initctl.distrib
diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash
local diversion of /usr/bin/man to /usr/bin/man.REAL
diversion of /bin/sh to /bin/sh.distrib by dash
```

So iterate over the output of `dpkg-divert --list` until the first
non-local diversion is found.

Signed-off-by: Benjamin Drung <email address hidden>

e478aad... by Benjamin Drung

test: Do not check recommended dependencies

`bash-completion` is only in Recommends for `bash` and might not be
installed in the test environment.

Signed-off-by: Benjamin Drung <email address hidden>

7b35109... by Benjamin Drung

test: Check stdout/stderr of all apport-valgrind calls

Signed-off-by: Benjamin Drung <email address hidden>

cdd61c5... by Benjamin Drung

test: Ensure that as/gcc calls exit successfully

Signed-off-by: Benjamin Drung <email address hidden>

69bdebf... by Benjamin Drung

test: Mock ~/.apport-ignore.xml path

Running `test.test_python_crashes.T.test_ignoring` during Debian package
build fails, because the home directory does not exist:

```
======================================================================
ERROR: test_ignoring (__main__.T)
the Python crash hook respects the ignore list.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_python_crashes.py", line 271, in test_ignoring
    r.mark_ignore()
  File "apport/report.py", line 1190, in mark_ignore
    with open(ignore_file_path, 'w') as fd:
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/.apport-ignore.xml'
```

To be able to run the test without an existing home directory, mock the
`.apport-ignore.xml` file.

Signed-off-by: Benjamin Drung <email address hidden>

60d6b43... by Benjamin Drung

test: Put Python test script into /var/tmp

The variable `apport.fileutils.report_dir` reads the environment
variable `APPORT_REPORT_DIR` which can point to a directory that is
ignored by the Python hook.

So explicitly put the Python test script into `/var/tmp` (similar to
code in `_test_crash`).

Signed-off-by: Benjamin Drung <email address hidden>

efd2c51... by Benjamin Drung

Drop debug argument from ParseSegv.__init__

The test case `test_debug` changes `sys.stderr`, but does not reset it
after the test finishes. That leaves stderr changed for the following
test cases (which is not desired).

Since only this one test case specifies the `debug` argument, drop this
argument and also the logging setup code (which would influence the
following test cases as well). Use `assertLogs` in `test_debug` to
change the logging level and also check that something is logged on
debug level.

Signed-off-by: Benjamin Drung <email address hidden>

7cfe968... by Benjamin Drung

Set HOME to /nonexistent when calling gdb

The test case `test_add_gdb_info_exe_missing` will fail on Ubuntu 22.04
with non English locale configured:

```
$ python3 -m unittest test.test_report.T.test_add_gdb_info_exe_missing
Warnung: Memory read failed for corefile section, 4096 bytes at 0xffffffffff600000.
WARNING: Please install gdb-multiarch for processing reports from foreign architectures. Results with "gdb" will be very poor.
WARNING: Please install gdb-multiarch for processing reports from foreign architectures. Results with "gdb" will be very poor.
F
======================================================================
FAIL: test_add_gdb_info_exe_missing (test.test_report.T)
add_gdb_info() with missing executable
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_report.py", line 693, in test_add_gdb_info_exe_missing
    self.assertRaises(FileNotFoundError, pr.add_gdb_info)
AssertionError: FileNotFoundError not raised by add_gdb_info

----------------------------------------------------------------------
Ran 1 test in 0.546s

FAILED (failures=1)
```

Printing the output of the `gdb` call shows that some error messages
from gdb are translated (even with no environment variable set).

Setting an environment variable (like `LC_ALL=C`) when calling gdb will
trigger a warning:

```
/usr/bin/gdb: warning: Couldn't determine a path for the index cache directory.
```

So set the environment variable `HOME` to `/nonexistent` to prevent this
warning and to cause gdb to use C locale.

Signed-off-by: Benjamin Drung <email address hidden>

7336677... by Benjamin Drung

test: Fix failure if kernel module isofs is not installed

The test case `test_module_license_evaluation` will fail if the kernel
module `isofs` is not installed.

```
======================================================================
FAIL: test_module_license_evaluation (__main__.T)
module licenses can be validated correctly
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/test_hookutils.py", line 38, in test_module_license_evaluation
    self.assertTrue('GPL' in apport.hookutils._get_module_license('isofs'))
AssertionError: False is not true

======================================================================
```

Split checking the license for the kernel module `isofs` into a separate
test case and skip this test case in case the kernel module is not
available.

Signed-off-by: Benjamin Drung <email address hidden>