Skip to content
Snippets Groups Projects
Commit 2615d550 authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau Committed by Florian Uhlig
Browse files

[CI] Add parsing of library to lib loading test (using f1st class in lib from rootmap)

parent 29b3b2a8
No related branches found
No related tags found
1 merge request!2064Add check of installed libraries
......@@ -15,16 +15,33 @@ LIBDIR=${2:-../lib}
# libraries are real files with the extensions .so and for macosx .dylib
all_libs=$(find $LIBDIR -type f -o -type l | grep -e \.dylib$ -e \.so$)
# Token used to find the first line with a class definition in the .rootmap files
start_token_class="class "
tmpfile=$(mktemp)
ok=true
okay=true
for lib in $all_libs; do
echo "Loading the library $lib"
root -l -q -b $SCRIPTDIR/loadlib.C\(\"$lib\"\) &> $tmpfile
first_class=""
rootmap_file="${lib%%".so"}".rootmap
if [ -f "${rootmap_file}" ]; then
rootmap_defs_token="\[ lib"
if [[ ${rootmap_file} == *"libHal"* ]]; then
# Commented out for now as lead to missing headers detection in 60% of HAL libraries (9/14)
# rootmap_defs_token="\[ Hal"
fi
first_class=$(awk -v token="${rootmap_defs_token}" '$0 ~ token ,0' ${rootmap_file} | grep -m1 "${start_token_class}" | tr -d ';')
first_class="${first_class##"${start_token_class}"}"
fi
# echo "Loading the library ${lib} and parsing it for class ${first_class}"
root -l -q -b "${SCRIPTDIR}/loadlib.C(\"${lib}\", \"${first_class}\")" &> ${tmpfile}
retval=$?
if [[ retval -ne 0 ]]; then
echo ""
echo "Problem loading the library $lib"
echo "Problem loading or parsing the library $lib: ${retval}"
cat $tmpfile
echo ""
okay=false
......@@ -35,7 +52,7 @@ rm $tmpfile
if [[ "$okay" = "false" ]]; then
echo ""
echo "Not all libraries could be loaded"
echo "Not all libraries could be loaded and parsed"
echo "Test failed"
exit 1
else
......
/* Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
/* Copyright (C) 2020-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Florian Uhlig [committer] */
Authors: Florian Uhlig [committer], Pierre-Alain Loizeau */
Int_t loadlib(TString libname)
Int_t loadlib(TString libname, TString classname = "")
{
// This method returns 0 if it succeed, 1 if already loaded, -1 if lib not found and -2 if failed
Int_t retval = gSystem->Load(libname);
if (0 == retval && "" != classname) {
// This one returns 1 in case of success and 0 in case of failure
// => Remap to next negative code after those used by the Load thod above
if (1 == gInterpreter->AutoParse(classname)) {
retval = 0;
}
else {
retval = -3;
}
}
return retval;
}
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