Skip to content
Snippets Groups Projects
Commit 21d99aa3 authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa Committed by Brad King
Browse files

Tests: Use a less strict regular expression to look for "SONAME"

Commit 899458ab (Tests: Cover NO_SONAME property for SHARED libraries,
2015-08-20) introduced a few new ExportImport tests, and the
check_lib_{no}soname.cmake scripts that parse readelf(1)'s output.

Make the regular expression matching the SONAME line output by readelf
less strict, as the output format varies across implementations: GNU
binutils' readelf is the only one to write each ELF header within
parentheses (which the previous regular expression expected).  The new
tests were thus failing when either Fedora's elfutils (eu-readelf) or
elftoolchain's readelf (present on recent FreeBSD versions) were being
used, as they both list the headers without parentheses.

The same issue also affected Tests/Plugin's check_mod_soname.cmake, so
fix that one as well -- the only reason the test was not failing is that
it tested that the regular expression did not match, which was always
the case with a non-binutils readelf.
parent f799ffb5
No related branches found
No related tags found
No related merge requests found
execute_process(COMMAND ${readelf} -d ${lib} OUTPUT_FILE ${lib}.readelf.txt)
file(STRINGS ${lib}.readelf.txt soname REGEX "\\(SONAME\\)")
file(STRINGS ${lib}.readelf.txt soname REGEX "SONAME")
if(soname)
message(FATAL_ERROR "${lib} has soname but should not:\n ${soname}")
else()
......
execute_process(COMMAND ${readelf} -d ${lib} OUTPUT_FILE ${lib}.readelf.txt)
file(STRINGS ${lib}.readelf.txt soname REGEX "\\(SONAME\\)")
file(STRINGS ${lib}.readelf.txt soname REGEX "SONAME")
if(soname)
message(STATUS "${lib} has soname as expected:\n ${soname}")
else()
......
execute_process(COMMAND ${readelf} -d ${mod} OUTPUT_FILE ${mod}.readelf.txt)
file(STRINGS ${mod}.readelf.txt soname REGEX "\\(SONAME\\)")
file(STRINGS ${mod}.readelf.txt soname REGEX "SONAME")
if(soname)
message(FATAL_ERROR "${mod} has soname but should not:\n ${soname}")
else()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment