Skip to content

Commit d1c9e2f

Browse files
authored
Fix run ubuntu 22.04 (#649)
* Fix run ubuntu 22.04 * Fix stubs
1 parent df7f800 commit d1c9e2f

File tree

8 files changed

+28
-18
lines changed

8 files changed

+28
-18
lines changed

Diff for: docker/release_distribution_scripts/utbot_run_system.sh

+8-7
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,19 @@ export UTBOT_LOGS_FOLDER=$UTBOT_ALL
3939
export UTBOT_INSTALL_DIR=$UTBOT_ALL/install
4040
export CC=$UTBOT_ALL/install/bin/clang
4141
export CXX=$UTBOT_ALL/install/bin/clang++
42-
export CPATH=$UTBOT_ALL/klee/include:$CPATH # Path for C and C++ includes
43-
export PATH=$UTBOT_ALL/bear/bin:$UTBOT_ALL/klee/bin:$UTBOT_INSTALL_DIR/bin:$PATH
42+
export CPATH=$UTBOT_ALL/klee/include${CPATH:+:${CPATH}} # Path for C and C++ includes
43+
export PATH=$UTBOT_ALL/bear/bin:$UTBOT_ALL/klee/bin:$UTBOT_INSTALL_DIR/bin${PATH:+:${PATH}}
4444
export KLEE_RUNTIME_LIBRARY_PATH=$UTBOT_ALL/klee/lib/klee/runtime/
4545

4646
# If the system is opensuse, variable is not empty. It is empty otherwise.
4747
IS_SUSE="$(grep '^NAME=' /etc/os-release | tr '[:upper:]' '[:lower:]' | grep suse)"
4848

4949
# Setting environment variables for debian packages
50-
export PATH=$UTBOT_ALL/debs-install/usr/bin:$PATH
51-
export LD_LIBRARY_PATH=$UTBOT_ALL/install/lib:$UTBOT_ALL/debs-install/lib/x86_64-linux-gnu:$UTBOT_ALL/debs-install/usr/lib/x86_64-linux-gnu:$UTBOT_ALL/debs-install/usr/local/lib:$UTBOT_ALL/debs-install/lib:$UTBOT_ALL/debs-install/usr/lib:$LD_LIBRARY_PATH
52-
export CPATH=$UTBOT_ALL/debs-install/usr/lib/gcc/x86_64-linux-gnu/9/include:$UTBOT_ALL/debs-install/usr/local/include:$UTBOT_ALL/debs-install/usr/include/x86_64-linux-gnu:$UTBOT_ALL/debs-install/usr/include:$CPATH
53-
export CPLUS_INCLUDE_PATH=$UTBOT_ALL/debs-install/usr/include/c++/9:$UTBOT_ALL/debs-install/usr/include/x86_64-linux-gnu/c++/9:$UTBOT_ALL/debs-install/usr/include/c++/9/backward:$CPLUS_INCLUDE_PATH
50+
export PATH=$UTBOT_ALL/debs-install/usr/bin${PATH:+:${PATH}}
51+
export LD_LIBRARY_PATH=$UTBOT_ALL/install/lib:$UTBOT_ALL/debs-install/lib/x86_64-linux-gnu:$UTBOT_ALL/debs-install/usr/lib/x86_64-linux-gnu:$UTBOT_ALL/debs-install/usr/local/lib:$UTBOT_ALL/debs-install/lib:$UTBOT_ALL/debs-install/usr/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
52+
export GENERAL_INCLUDES=$UTBOT_ALL/debs-install/usr/lib/gcc/x86_64-linux-gnu/9/include:$UTBOT_ALL/debs-install/usr/local/include:$UTBOT_ALL/debs-install/usr/include/x86_64-linux-gnu:$UTBOT_ALL/debs-install/usr/include
53+
export C_INCLUDE_PATH=GENERAL_INCLUDES${C_INCLUDE_PATH:+:${C_INCLUDE_PATH}}
54+
export CPLUS_INCLUDE_PATH=$UTBOT_ALL/debs-install/usr/include/c++/9:$UTBOT_ALL/debs-install/usr/include/x86_64-linux-gnu/c++/9:$UTBOT_ALL/debs-install/usr/include/c++/9/backward:GENERAL_INCLUDES${CPLUS_INCLUDE_PATH:+:${CPLUS_INCLUDE_PATH}}
5455
export LDFLAGS="-fuse-ld=gold $LDFLAGS"
5556

5657
# This function moves dev version of libc into $UTBOT_ALL/debs-install directory
@@ -133,7 +134,7 @@ then
133134
PROJECT_PATH=$4
134135
mkdir -p $PROJECT_PATH/build
135136
cd $PROJECT_PATH/build || exit
136-
137+
137138
if [ -f "../$UTBOT_BUILD_SCRIPT" ]
138139
then
139140
echo "Trying to run '$UTBOT_BUILD_SCRIPT'!"

Diff for: server/src/KleeRunner.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ void KleeRunner::processBatchWithoutInteractive(const std::vector<tests::TestMet
285285
std::vector<char *> cargv, cenvp;
286286
std::vector<std::string> tmp;
287287
ExecUtils::toCArgumentsPtr(argvData, tmp, cargv, cenvp, false);
288-
LOG_S(DEBUG) << "Klee command :: " + StringUtils::joinWith(argvData, " ");
288+
LOG_S(DEBUG) << "Klee command: " + StringUtils::joinWith(argvData, " ");
289289
MEASURE_FUNCTION_EXECUTION_TIME
290290

291291
RunKleeTask task(cargv.size(), cargv.data(), settingsContext.timeoutPerFunction);
@@ -341,7 +341,7 @@ void KleeRunner::processBatchWithInteractive(const std::vector<tests::TestMethod
341341
std::vector<std::string> tmp;
342342
ExecUtils::toCArgumentsPtr(argvData, tmp, cargv, cenvp, false);
343343

344-
LOG_S(DEBUG) << "Klee command :: " + StringUtils::joinWith(argvData, " ");
344+
LOG_S(DEBUG) << "Klee command: " + StringUtils::joinWith(argvData, " ");
345345
MEASURE_FUNCTION_EXECUTION_TIME
346346

347347
RunKleeTask task(cargv.size(),

Diff for: server/src/printers/NativeMakefilePrinter.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ namespace printer {
250250
}
251251

252252
compileCommand.setOptimizationLevel(OPTIMIZATION_FLAG);
253-
compileCommand.addEnvironmentVariable("C_INCLUDE_PATH", "$UTBOT_LAUNCH_INCLUDE_PATH");
254253
compileCommand.addFlagToBegin(FPIC_FLAG);
255254
compileCommand.addFlagsToBegin(SANITIZER_NEEDED_FLAGS);
256255
compileCommand.addFlagsToBegin(

Diff for: server/src/printers/Printer.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,18 @@ namespace printer {
539539
}
540540
}
541541

542+
void printer::Printer::writeExternForSymbolicStubs(const Tests::MethodDescription& testMethod) {
543+
std::unordered_map<std::string, std::string> symbolicNamesToTypesMap;
544+
for (const auto& testCase: testMethod.testCases) {
545+
for (size_t i = 0; i < testCase.stubValues.size(); i++) {
546+
symbolicNamesToTypesMap[testCase.stubValues[i].name] = testCase.stubValuesTypes[i].type.usedType();
547+
}
548+
}
549+
for (const auto& [name, type]: symbolicNamesToTypesMap) {
550+
strDeclareVar("extern \"C\" " + type, name);
551+
}
552+
}
553+
542554
void printer::Printer::writeStubForParam(const types::TypesHandler *typesHandler,
543555
const std::shared_ptr<types::FunctionInfo> &fInfo,
544556
const std::string &methodName,

Diff for: server/src/printers/Printer.h

+2
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ namespace printer {
202202
const Tests::MethodDescription& testMethod,
203203
bool forKlee);
204204

205+
void writeExternForSymbolicStubs(const Tests::MethodDescription& testMethod);
206+
205207
void writeStubsForStructureFields(const Tests &tests);
206208

207209
void writeStubsForParameters(const Tests &tests);

Diff for: server/src/printers/TestsPrinter.cpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,6 @@ void TestsPrinter::joinToFinalCode(Tests &tests, const fs::path& generatedHeader
6464
genHeaders(tests, generatedHeaderPath);
6565
ss << NL;
6666

67-
if (!tests.methods.empty()) {
68-
for (const auto &stubsHeader: tests.methods.begin()->second.stubsStorage->getStubsHeaders()) {
69-
strInclude(stubsHeader) << NL;
70-
}
71-
}
72-
7367
strDeclareSetOfVars(tests.externVariables);
7468

7569
ss << "namespace " << PrinterUtils::TEST_NAMESPACE << " {\n";
@@ -177,6 +171,7 @@ void TestsPrinter::genCode(Tests::MethodDescription &methodDescription,
177171
int testNum = 0;
178172

179173
writeStubsForFunctionParams(typesHandler, methodDescription, false);
174+
writeExternForSymbolicStubs(methodDescription);
180175

181176
methodDescription.stubsText = ss.str();
182177
resetStream();

Diff for: server/src/tasks/BaseForkTask.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ ExecUtils::ExecutionResult BaseForkTask::run() {
7070
status = TIMEOUT_CODE;
7171
}
7272
if (!ignoreErrors && status && status != TIMEOUT_CODE) {
73-
LOG_S(ERROR) << "Exit status: " << status;
73+
LOG_S(ERROR) << "Exit status '" << processName << "': " << status;
74+
LOG_S(ERROR) << "Output: " << output;
7475
LOG_S(ERROR) << "See details in " << logFilePath;
7576
}
7677
LOG_IF_S(DEBUG, status == 0) << "Exit status: 0";

Diff for: server/test/framework/TestUtils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ namespace testUtils {
325325
case CompilationUtils::CompilerName::GCC:
326326
return StringUtils::stringFormat(
327327
"rm -rf build_gcc && mkdir -p build_gcc && cd build_gcc && "
328-
"export CC=%s && export CXX=%s && export C_INCLUDE_PATH=$UTBOT_LAUNCH_INCLUDE_PATH",
328+
"export CC=%s && export CXX=%s",
329329
Paths::getGcc(), Paths::getGpp());
330330
case CompilationUtils::CompilerName::CLANG:
331331
return StringUtils::stringFormat(

0 commit comments

Comments
 (0)