Skip to content

Commit

Permalink
[CI] DOCA compilation: fix compiler.sh failures
Browse files Browse the repository at this point in the history
- Install all required compilers inside comtainer rather than connecting modules
- Use update-alternatives to switch between compilers

Issue: HPCINFRA-1968

Signed-off-by: Viacheslav Login <vlogin@nvidia.com>
  • Loading branch information
vialogi committed Jul 11, 2024
1 parent b22c385 commit 85bfca5
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 42 deletions.
36 changes: 36 additions & 0 deletions .ci/dockerfiles/Dockerfile.ubuntu22.04
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,42 @@ RUN echo "${_LOGIN} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
chown -R ${_LOGIN} ${_HOME} && \
mkdir /build && chown -R ${_LOGIN} /build

FROM build AS toolbox
RUN apt-get update \
&& wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/gcc-8_8.4.0-3ubuntu2_amd64.deb \
&& wget http://mirrors.edge.kernel.org/ubuntu/pool/universe/g/gcc-8/gcc-8-base_8.4.0-3ubuntu2_amd64.deb \
&& wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/libgcc-8-dev_8.4.0-3ubuntu2_amd64.deb \
&& wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/cpp-8_8.4.0-3ubuntu2_amd64.deb \
&& wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/libmpx2_8.4.0-3ubuntu2_amd64.deb \
&& wget http://mirrors.kernel.org/ubuntu/pool/main/i/isl/libisl22_0.22.1-1_amd64.deb \
&& apt install -y ./libisl22_0.22.1-1_amd64.deb ./libmpx2_8.4.0-3ubuntu2_amd64.deb \
./cpp-8_8.4.0-3ubuntu2_amd64.deb ./libgcc-8-dev_8.4.0-3ubuntu2_amd64.deb \
./gcc-8-base_8.4.0-3ubuntu2_amd64.deb ./gcc-8_8.4.0-3ubuntu2_amd64.deb \
&& wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/libstdc++-8-dev_8.4.0-3ubuntu2_amd64.deb \
&& wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-8/g++-8_8.4.0-3ubuntu2_amd64.deb \
&& apt install -y ./libstdc++-8-dev_8.4.0-3ubuntu2_amd64.deb ./g++-8_8.4.0-3ubuntu2_amd64.deb \
&& apt install -y software-properties-common \
&& add-apt-repository ppa:ubuntu-toolchain-r/test -y \
&& apt update \
&& apt install -y gcc-9 g++-9 clang-14 \
&& apt install -y gcc-9-multilib g++-9-multilib \
&& apt install -y gcc-10 g++-10 \
&& apt install -y gcc-10-multilib g++-10-multilib \
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-15 100 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-15 \
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-14 90 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-14 \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 70 \
--slave /usr/bin/g++ g++ /usr/bin/g++-8 \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 80 \
--slave /usr/bin/g++ g++ /usr/bin/g++-9 \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 90 \
--slave /usr/bin/g++ g++ /usr/bin/g++-10 \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 \
--slave /usr/bin/g++ g++ /usr/bin/g++-11 \
&& rm -rf *.deb \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

FROM build AS tests
RUN apt-get update && \
apt-get install -y \
Expand Down
11 changes: 5 additions & 6 deletions contrib/jenkins_tests/compiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,26 @@ rm -rf $compiler_dir
mkdir -p $compiler_dir
cd $compiler_dir

compiler_list="clang:clang++:dev/clang-9.0.1 icc:icpc:intel/ics-18.0.4 icc:icpc:intel/ics-19.1.1 gcc:g++:dev/gcc-8.3.0 gcc:g++:dev/gcc-9.3.0 gcc:g++:dev/gcc-10.1.0"
compiler_list="clang:clang++:clang-15 gcc:g++:gcc-8 gcc:g++:gcc-9 gcc:g++:gcc-10 gcc:g++:gcc-11"

compiler_tap=${WORKSPACE}/${prefix}/compiler.tap
echo "1..$(echo $compiler_list | tr " " "\n" | wc -l)" > $compiler_tap

test_id=0
for compiler in $compiler_list; do
IFS=':' read cc cxx module <<< "$compiler"
IFS=':' read cc cxx version <<< "$compiler"
update-alternatives --set $cc /usr/bin/$version
mkdir -p ${compiler_dir}/${test_id}
cd ${compiler_dir}/${test_id}
[ -z "$module" ] && test_name=$($cc --version | head -n 1) || test_name="$module"
[ ! -z "$module" ] && do_module "$module"
test_name="$version"
echo "======================================================"
$cc --version
echo
test_exec='${WORKSPACE}/configure --prefix=$compiler_dir-$cc CC=$cc CXX=$cxx --disable-lto $jenkins_test_custom_configure && make $make_opt all'
do_check_result "$test_exec" "$test_id" "$test_name" "$compiler_tap" "${compiler_dir}/compiler-${test_id}"
[ ! -z "$module" ] && module unload "$module"
cd ${compiler_dir}
test_id=$((test_id+1))
done

echo "[${0##*/}]..................exit code = $rc"
exit $rc
exit $rc
66 changes: 30 additions & 36 deletions contrib/jenkins_tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,43 +108,37 @@ for test_link in $test_ip_list; do
test_name=${test_in}-${test}
test_tap=${WORKSPACE}/${prefix}/test-${test_name}.tap

for i in $(seq 3); do
if [ ! -z "${test_remote_ip}" ] ; then

eval "pid=$(${sudo_cmd} pidof ${prj_service})"
[ ! -z "${pid}" ] && eval "${sudo_cmd} kill -9 ${pid}"
eval "${sudo_cmd} ${install_dir}/sbin/${prj_service} --console -v5 & "

echo "BUILD_NUMBER=${BUILD_NUMBER}"
eval "pid=$(${sudo_cmd} ssh ${rmt_user}@${test_remote_ip} pidof ${prj_service})"
if [ ! -z "${pid}" ] ; then
echo "${prj_service} pid=${pid}"
eval "${sudo_cmd} ssh ${rmt_user}@${test_remote_ip} kill -9 ${pid}"
fi
${sudo_cmd} scp -q ${install_dir}/sbin/${prj_service} ${rmt_user}@${test_remote_ip}:${sperf_exec_dir}
eval "${sudo_cmd} ssh ${rmt_user}@${test_remote_ip} ${sudo_cmd} ${sperf_exec_dir}/${prj_service} &"

vutil="$(dirname $0)/vutil.sh"
[ ! -e "${vutil}" ] && { echo "error vutil not found" ; exit 1 ; }

${sudo_cmd} $timeout_exe ${vutil} -a "${test_app}" -x "--load-vma=${test_lib} " -t "${test}:tc[1-9]$" \
-s "${test_remote_ip}" -p "${test_remote_port}" -l "${test_dir}/${test_name}.log" \
-e "XLIO_TX_BUFS=20000"
else
${sudo_cmd} $timeout_exe $PWD/tests/verifier/verifier.pl -a ${test_app} -x " --debug " \
-t ${test}:tc[1-9]$ -s ${test_ip} -l ${test_dir}/${test_name}.log \
-e " LD_PRELOAD=$test_lib " \
--progress=0
fi
if [ ! -z "${test_remote_ip}" ] ; then

cp $PWD/${test_name}.dump ${test_dir}/${test_name}.dump
if grep -q 'FAIL' ${test_dir}/${test_name}.dump; then
rm -fv ${test_dir}/${test_name}.log ${test_dir}/${test_name}.dump
else
break
eval "pid=$(${sudo_cmd} pidof ${prj_service})"
[ ! -z "${pid}" ] && eval "${sudo_cmd} kill -9 ${pid}"
eval "${sudo_cmd} ${install_dir}/sbin/${prj_service} --console -v5 & "

echo "BUILD_NUMBER=${BUILD_NUMBER}"
eval "pid=$(${sudo_cmd} ssh ${rmt_user}@${test_remote_ip} pidof ${prj_service})"
if [ ! -z "${pid}" ] ; then
echo "${prj_service} pid=${pid}"
eval "${sudo_cmd} ssh ${rmt_user}@${test_remote_ip} kill -9 ${pid}"
fi
done
grep -e 'PASS' -e 'FAIL' ${test_dir}/${test_name}.dump > ${test_dir}/${test_name}.tmp
${sudo_cmd} scp -q ${install_dir}/sbin/${prj_service} ${rmt_user}@${test_remote_ip}:${sperf_exec_dir}
eval "${sudo_cmd} ssh ${rmt_user}@${test_remote_ip} ${sudo_cmd} ${sperf_exec_dir}/${prj_service} &"

vutil="$(dirname $0)/vutil.sh"
[ ! -e "${vutil}" ] && { echo "error vutil not found" ; exit 1 ; }

${sudo_cmd} $timeout_exe ${vutil} -a "${test_app}" -x "--load-vma=${test_lib} " -t "${test}:tc[1-9]$" \
-s "${test_remote_ip}" -p "${test_remote_port}" -l "${test_dir}/${test_name}.log" \
-e "XLIO_TX_BUFS=20000"
else
${sudo_cmd} $timeout_exe $PWD/tests/verifier/verifier.pl -a ${test_app} -x " --debug " \
-t ${test}:tc[1-9]$ -s ${test_ip} -l ${test_dir}/${test_name}.log \
-e " LD_PRELOAD=$test_lib " \
--progress=0
fi

cp $PWD/${test_name}.dump ${test_dir}/${test_name}.dump

grep -e 'PASS' -e 'FAIL' ${test_dir}/${test_name}.dump > ${test_dir}/${test_name}.tmp

do_archive "${test_dir}/${test_name}.dump" "${test_dir}/${test_name}.log"

Expand All @@ -171,4 +165,4 @@ done
rc=$(($rc+$nerrors))

echo "[${0##*/}]..................exit code = $rc"
exit $rc
exit $rc

0 comments on commit 85bfca5

Please sign in to comment.