Skip to content

Commit b5c488b

Browse files
committed
Coverage, resolving comments
1 parent 612af09 commit b5c488b

File tree

5 files changed

+27
-29
lines changed

5 files changed

+27
-29
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ jobs:
5757
llvm_enable_projects: "clang"
5858
llvm_targets_to_build: "host;NVPTX"
5959
# Ubuntu X86 Jobs
60-
- name: ubu22-x86-gcc12-clang-repl-20-coverage
61-
os: ubuntu-22.04
60+
- name: ubu24-x86-gcc12-clang-repl-20-coverage
61+
os: ubuntu-24.04
6262
compiler: gcc-12
6363
clang-runtime: '20'
6464
cling: Off
@@ -255,16 +255,14 @@ jobs:
255255
with:
256256
cache-hit: ${{ steps.cache.outputs.cache-hit }}
257257

258-
# REVERT BEFORE MERGING
259-
# - name: Cache LLVM-${{ matrix.clang-runtime }} and ${{ matrix.cling == 'On' && 'Cling' || 'Clang-REPL' }} build
260-
# uses: actions/cache/save@v4
261-
# if: ${{ steps.cache.outputs.cache-hit != 'true' }}
262-
# with:
263-
# path: |
264-
# llvm-project
265-
# ${{ matrix.cling=='On' && 'cling' || '' }}
266-
# key: ${{ steps.cache.outputs.cache-primary-key }}
267-
# REVERT BEFORE MERGING
258+
- name: Cache LLVM-${{ matrix.clang-runtime }} and ${{ matrix.cling == 'On' && 'Cling' || 'Clang-REPL' }} build
259+
uses: actions/cache/save@v4
260+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
261+
with:
262+
path: |
263+
llvm-project
264+
${{ matrix.cling=='On' && 'cling' || '' }}
265+
key: ${{ steps.cache.outputs.cache-primary-key }}
268266

269267
- name: Setup code coverage
270268
if: ${{ success() && (matrix.coverage == true) }}
@@ -282,7 +280,7 @@ jobs:
282280
# Create lcov report
283281
# capture coverage info
284282
vers="${CC#*-}"
285-
lcov --directory build/ --capture --output-file coverage.info --gcov-tool /usr/bin/gcov-${vers}
283+
lcov --directory build/ --capture --output-file coverage.info --gcov-tool /usr/bin/gcov-${vers} --ignore-errors mismatch
286284
lcov --remove coverage.info '/usr/*' ${{ github.workspace }}'/llvm-project/*' --ignore-errors unused --output-file coverage.info
287285
lcov --remove coverage.info '${{ github.workspace }}/unittests/*' --ignore-errors unused --output-file coverage.info
288286
lcov --remove coverage.info '${{ github.workspace }}/build/*' --ignore-errors unused --output-file coverage.info

lib/CppInterOp/Compatibility.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ createClangInterpreter(std::vector<const char*>& args, int stdin_fd = -1,
260260
if (CudaEnabled)
261261
DeviceCI->LoadRequestedPlugins();
262262

263-
bool outOfProcess = (stdin_fd != -1 && stdout_fd != -1 && stderr_fd != -1);
263+
bool outOfProcess = (stdin_fd != 0 && stdout_fd != 1 && stderr_fd != 2);
264264

265265
#ifdef LLVM_BUILT_WITH_OOP_JIT
266266

lib/CppInterOp/CppInterOpInterpreter.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ class Interpreter {
174174
static std::tuple<int, int, int>
175175
initAndGetFileDescriptors(std::vector<const char*>& vargs,
176176
std::unique_ptr<IOContext>& io_ctx) {
177-
int stdin_fd = -1;
178-
int stdout_fd = -1;
179-
int stderr_fd = -1;
177+
int stdin_fd = 0;
178+
int stdout_fd = 1;
179+
int stderr_fd = 2;
180180
bool outOfProcess = false;
181181

182182
#if defined(_WIN32)
@@ -193,6 +193,9 @@ class Interpreter {
193193
if (!init) {
194194
llvm::errs() << "Can't start out-of-process JIT execution.\n";
195195
outOfProcess = false;
196+
stdin_fd = -1;
197+
stdout_fd = -1;
198+
stderr_fd = -1;
196199
}
197200
}
198201
if (outOfProcess) {
@@ -237,7 +240,12 @@ class Interpreter {
237240
std::tie(stdin_fd, stdout_fd, stderr_fd) =
238241
initAndGetFileDescriptors(vargs, io_ctx);
239242

240-
bool outOfProcess = (stdin_fd != -1 && stdout_fd != -1 && stderr_fd != -1);
243+
if (stdin_fd == -1 || stdout_fd == -1 || stderr_fd == -1) {
244+
llvm::errs() << "Redirection files creation failed for Out-Of-Process JIT\n";
245+
return nullptr;
246+
}
247+
248+
bool outOfProcess = (stdin_fd != 0 && stdout_fd != 1 && stderr_fd != 2);
241249

242250
auto CI =
243251
compat::createClangInterpreter(vargs, stdin_fd, stdout_fd, stderr_fd);

unittests/CppInterOp/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
set(EXTRA_TEST_SOURCE_FILES Utils.cpp)
2-
31
if (EMSCRIPTEN)
42
# So we create a html file, as well as the javascript file
53
set(CMAKE_EXECUTABLE_SUFFIX ".html")
64
# Omitting CUDATest.cpp since Emscripten build currently has no GPU support
75
# For Emscripten builds linking to gtest_main will not suffice for gtest to run
86
# the tests and an explicitly main.cpp is needed
9-
list(APPEND EXTRA_TEST_SOURCE_FILES main.cpp)
7+
set(EXTRA_TEST_SOURCE_FILES main.cpp)
108
else()
119
# Do not need main.cpp for native builds, but we do have GPU support for native builds
12-
list(APPEND EXTRA_TEST_SOURCE_FILES CUDATest.cpp)
10+
set(EXTRA_TEST_SOURCE_FILES CUDATest.cpp)
1311
set(EXTRA_PATH_TEST_BINARIES /CppInterOpTests/unittests/bin/$<CONFIG>/)
1412
endif()
1513

@@ -20,6 +18,7 @@ add_cppinterop_unittest(CppInterOpTests
2018
JitTest.cpp
2119
ScopeReflectionTest.cpp
2220
TypeReflectionTest.cpp
21+
Utils.cpp
2322
VariableReflectionTest.cpp
2423
${EXTRA_TEST_SOURCE_FILES}
2524
)

unittests/CppInterOp/InterpreterTest.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@
2727

2828
using ::testing::StartsWith;
2929

30-
class InterpreterTest : public ::testing::TestWithParam<TestUtils::TestConfig> {
31-
protected:
32-
void SetUp() override {
33-
TestUtils::current_config = GetParam();
34-
}
35-
};
36-
3730
TYPED_TEST(CppInterOpTest, InterpreterTestVersion) {
3831
EXPECT_THAT(Cpp::GetVersion(), StartsWith("CppInterOp version"));
3932
}

0 commit comments

Comments
 (0)