Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to Debian 12 #4417

Merged
merged 16 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,12 @@ endif (${CMAKE_BUILD_TYPE} STREQUAL DEBUG)
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable")
#endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")

# Enables some some #ifdef in the code for compiling in old system
# FIXME: cleanup OLD_SSL_VERSION_FORMAT stuff after consolidating the change to Debian 12+
IF(${DISTRO} MATCHES "Debian_11.*")
ADD_DEFINITIONS(-DOLD_SSL_VERSION_FORMAT)
ENDIF()

#
# Libraries
#
Expand Down
5 changes: 2 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# iot_support at tid dot es
#

ARG IMAGE_TAG=11.6-slim
ARG IMAGE_TAG=12.1-slim
FROM debian:${IMAGE_TAG}

ARG GITHUB_ACCOUNT=telefonicaid
Expand Down Expand Up @@ -146,8 +146,7 @@ RUN \
apt-get -y autoremove --purge && \
# The above apt removal erases some dependencies needed by contextBroker. So we reinstall it
apt-get -y install \
libicu67 \
libcurl4 \
libicu72 \
libboost-thread1.74.0 && \
# Don't need old log files inside docker images
rm -f /var/log/*log
Expand Down
2 changes: 2 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ ftd: functional_test_debug
test: unit_test functional_test

coverage: install_coverage
# FIXME #4418: the functional test part of this target is not working properly. Check issue for details.
# Init coverage
echo "Initializing coverage files"
mkdir -p coverage
Expand Down Expand Up @@ -291,6 +292,7 @@ coverage_unit_test: build_unit_test
genhtml -o coverage coverage/broker.info

coverage_functional_test: install_coverage
# FIXME #4418: this target is not working properly. Check issue for details.
# Init coverage
echo "Initializing coverage files"
mkdir -p coverage
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_files_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def ignore(root, file):
return True

# Apib files have an "inline" license, so they are ignored
extensions_to_ignore = [ 'apib', 'md' ]
extensions_to_ignore = [ 'apib', 'md', 'patch']
if os.path.splitext(file)[1][1:] in extensions_to_ignore:
return True

Expand Down
5 changes: 5 additions & 0 deletions src/lib/serviceRoutines/versionTreat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ std::string libVersions(void)
total += curl + "\"" + curlVersion + "\"" + ",\n";
total += mosq + "\"" + mosqVersion + "\"" + ",\n";
total += mhd + "\"" + MHD_get_version() + "\"" + ",\n";
#ifdef OLD_SSL_VERSION_FORMAT
// Needed by openssl 1.1.1n in Debian 11 and before
total += ssl + "\"" + SHLIB_VERSION_NUMBER "\"" + ",\n";
#else
total += ssl + "\"" + OPENSSL_FULL_VERSION_STR "\"" + ",\n";
#endif
total += rjson + "\"" + RAPIDJSON_VERSION_STRING "\"" + ",\n";
total += mongo + "\"" + MONGOC_VERSION_S "\"" + ",\n";
total += bson + "\"" + BSON_VERSION_S "\"" + "\n";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ echo "04. Look in the CB log for the warning about cert not accepted"
echo "=============================================================="

# Depdending the system the message in the logs may be diferent. For instance, it has been found than in
# CentOS8 and Debian 9 the message is "Peer certificate cannot be authenticated" but in Debian 11
# CentOS8 and Debian 9 the message is "Peer certificate cannot be authenticated" but in Debian 11/12
# is "Peer certificate cannot be authenticated". At the end this error message comes from the SSH library

grep "Peer certificate cannot be authenticated\|SSL peer certificate or SSH remote key was not OK" /tmp/contextBroker.log | grep "notification failure" | wc -l
Expand Down
5 changes: 5 additions & 0 deletions test/functionalTest/harnessFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,11 @@ function valgrindSleep()
# --quiet, but we need to get rid of some preamble lines about mongo version and
# connection information and a final 'bye' line
#
# NOTE: this will no longer work with new mongosh shell. Note that legacy shell
# (the 'mongo' command) has been deprecated in MongoDB 5.0 and removed in MongoDB 6.0.
# This function (and many .test using mongoCmd) would need fixing after stepping to
# MongoDB 6.0
#
function mongoCmd()
{
host="${CB_DATABASE_HOST}"
Expand Down
3 changes: 2 additions & 1 deletion test/functionalTest/testHarness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,8 @@ function testDisabled
dIx=0
while [ $dIx -lt ${#DISABLED[@]} ]
do
if [ test/functionalTest/cases/$testcase == ${DISABLED[$dIx]} ]
# Comparison is done based in filename, skipping the path (see https://stackdiary.com/tutorials/bash-get-filename-from-path/)
if [ "${testcase##*/}" == "${DISABLED[$dIx]##*/}" ]
Comment on lines +917 to +918
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not actually related with this PR, but found while I was investigating make coverage issues.

NTC (informative)

then
echo "Disabled"

Expand Down
6 changes: 2 additions & 4 deletions test/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,9 @@ MESSAGE("unitTest distro: '${DISTRO}'")

IF(${DISTRO} MATCHES "CentOS_6.*")
TARGET_LINK_LIBRARIES(unitTest ${STATIC_LIBS} ${BOOST_MT} ${DYNAMIC_LIBS})
ELSEIF((${DISTRO} MATCHES "Debian_8.*") OR (${DISTRO} MATCHES "Debian_9.*") OR (${DISTRO} MATCHES "Debian_10.*") OR (${DISTRO} MATCHES "Debian_11.*"))
# It seems that Debian 8.x/9.x doesn't like -mt libraries for unit tests... not sure about other Debian versions
TARGET_LINK_LIBRARIES(unitTest ${STATIC_LIBS} ${BOOST} ${DYNAMIC_LIBS})
# From Debian 8.x to 12.x: they don't like -mt libraries for unit tests
ELSEIF(${DISTRO} MATCHES "Debian_.*")
TARGET_LINK_LIBRARIES(unitTest ${STATIC_LIBS} ${BOOST_MT} ${DYNAMIC_LIBS})
TARGET_LINK_LIBRARIES(unitTest ${STATIC_LIBS} ${BOOST} ${DYNAMIC_LIBS})

# The following ones are distros that haven't been checked since the refactoring in
# PR #2062. They should be "promoted" as soon as we have positive feedback about
Expand Down
95 changes: 95 additions & 0 deletions test/unittests/fuse_gtest_files.py.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
This patch adapt the original fuse_gest_files.py to Python 3
Check build_source.md file to see how it is used

--- fuse_gtest_files.py.orig 2023-09-01 11:26:02.036070350 +0200
+++ fuse_gtest_files.py 2023-09-01 11:39:16.422565989 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# Copyright 2009, Google Inc.
# All rights reserved.
@@ -60,7 +60,6 @@

import os
import re
-import sets
import sys

# We assume that this file is in the scripts/ directory in the Google
@@ -90,8 +89,8 @@
"""

if not os.path.isfile(os.path.join(directory, relative_path)):
- print 'ERROR: Cannot find %s in directory %s.' % (relative_path,
- directory)
+ print ('ERROR: Cannot find %s in directory %s.' % (relative_path,
+ directory))
print ('Please either specify a valid project root directory '
'or omit it on the command line.')
sys.exit(1)
@@ -123,7 +122,7 @@
(relative_path, output_dir))
answer = sys.stdin.readline().strip()
if answer not in ['y', 'Y']:
- print 'ABORTED.'
+ print ('ABORTED.')
sys.exit(1)

# Makes sure the directory holding the output file exists; creates
@@ -146,8 +145,8 @@
def FuseGTestH(gtest_root, output_dir):
"""Scans folder gtest_root to generate gtest/gtest.h in output_dir."""

- output_file = file(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
- processed_files = sets.Set() # Holds all gtest headers we've processed.
+ output_file = open(os.path.join(output_dir, GTEST_H_OUTPUT), 'w')
+ processed_files = set() # Holds all gtest headers we've processed.

def ProcessFile(gtest_header_path):
"""Processes the given gtest header file."""
@@ -159,7 +158,7 @@
processed_files.add(gtest_header_path)

# Reads each line in the given gtest header.
- for line in file(os.path.join(gtest_root, gtest_header_path), 'r'):
+ for line in open(os.path.join(gtest_root, gtest_header_path), 'r'):
m = INCLUDE_GTEST_FILE_REGEX.match(line)
if m:
# It's '#include <gtest/...>' - let's process it recursively.
@@ -175,7 +174,7 @@
def FuseGTestAllCcToFile(gtest_root, output_file):
"""Scans folder gtest_root to generate gtest/gtest-all.cc in output_file."""

- processed_files = sets.Set()
+ processed_files = set()

def ProcessFile(gtest_source_file):
"""Processes the given gtest source file."""
@@ -187,7 +186,7 @@
processed_files.add(gtest_source_file)

# Reads each line in the given gtest source file.
- for line in file(os.path.join(gtest_root, gtest_source_file), 'r'):
+ for line in open(os.path.join(gtest_root, gtest_source_file), 'r'):
m = INCLUDE_GTEST_FILE_REGEX.match(line)
if m:
if 'include/' + m.group(1) == GTEST_SPI_H_SEED:
@@ -218,7 +217,7 @@
def FuseGTestAllCc(gtest_root, output_dir):
"""Scans folder gtest_root to generate gtest/gtest-all.cc in output_dir."""

- output_file = file(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
+ output_file = open(os.path.join(output_dir, GTEST_ALL_CC_OUTPUT), 'w')
FuseGTestAllCcToFile(gtest_root, output_file)
output_file.close()

@@ -242,7 +241,7 @@
# fuse_gtest_files.py GTEST_ROOT_DIR OUTPUT_DIR
FuseGTest(sys.argv[1], sys.argv[2])
else:
- print __doc__
+ print (__doc__)
sys.exit(1)


Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ TEST(DiscoverContextAvailabilityResponse, jsonRender)
rendered = dcarP->toJsonV1();
EXPECT_STREQ(expectedBuf, rendered.c_str());
dcarP->release(); // ... otherwise the 500 remains and "pollutes" next tests
free(dcarP);
delete dcarP;


// 2. One contextRegistrationResponse - errorCode inside ContextRegistrationResponse - only providingApplication in ContextRegistration
Expand Down Expand Up @@ -343,7 +343,7 @@ TEST(DiscoverContextAvailabilityResponse, jsonRender)
rendered = dcarP->toJsonV1();
EXPECT_STREQ(expectedBuf, rendered.c_str());

free(dcarP);
delete dcarP;

utExit();
}
Loading