Description
The example within example/math
produces a compile commands database that contains absolute filepaths. However, other compile commands databases may contain relative filepaths that are relative to the location of the compile commands database. For example, using the Meson build system to build Mesa 3D produces a compile commands database with relative filepaths.
The query_mutant_info.py
script assumes that the compile commands database contains absolute filepaths within the mutated source tree. The following command is used to provide information about the source code of a particular mutant ID:
python3 ${DREDD_CHECKOUT}/scripts/query_mutant_info.py mutant-info.json --show-info-for-mutant 10 --path-prefix-replacement ${MUTATED_SRC} ${ORIGINAL_SRC}
However, the --path-prefix-replacement
arguments only work with absolute filpaths, for which they are used to swap the mutated file location for the original file location. Relative filepaths do not include the path prefix, so this code produces an incorrect filepath.
To fix this, the query script could check whether each filepath is absolute with os.path.isabs()
, or perhaps there could be an option to explicitly differentiate between relative and absolute paths. If we think there could ever be a case in which the compile commands database mixes relative and absolute paths, then the former option would be better.
Activity