Commit 4736aaed authored by Jørgen Lind's avatar Jørgen Lind
Browse files

Merge branch 'feature/jorgen.lind/pytest_junit' into 'master'

Output junit test results for pytest

See merge request !610
parents 5dae81cc 57d8b6d9
Pipeline #111360 passed with stages
in 71 minutes and 38 seconds
......@@ -111,6 +111,7 @@ function(Fetch3rdParty)
Fetch3rdParty_File(jcommander java 1.72 jar https://repo1.maven.org/maven2/com/beust/jcommander/1.72/jcommander-1.72.jar MD5=9fde6bc0ba1032eceb7267fd1ad1657b)
Fetch3rdParty_FileTarget(google_nlohmann google/cloud/storage/internal nlohmann_json.hpp 3.4.0 https://raw.githubusercontent.com/nlohmann/json/v3.4.0/single_include/nlohmann/json.hpp MD5=27f3760c1d3a0fff7d8a2407d8db8f9d)
Fetch3rdParty_Package(cmakerc e7ba9e https://github.com/vector-of-bool/cmrc/archive/e7ba9e9417960b2a5cefc9e79e8af8b06bfde3d1.zip SHA256=75c1263bb37b8bae159bacb4da10fd2eb50b9c04118901218b6a817b9d0fa757)
Fetch3rdParty_Package(cxxopts 3.0.0 https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.0.0.tar.gz SHA256=36f41fa2a46b3c1466613b63f3fa73dc24d912bc90d667147f1e43215a8c6d00)
endfunction()
......
This diff is collapsed.
......@@ -102,19 +102,30 @@ mkdir -p $openvds_path/binpackage/python/$distribution/
for python_executable in "${python_executables[@]}"; do
python_ver=$("$python_executable" -c "import sys; print('.'.join(map(str, sys.version_info[:2])))")
python_root_dir=$("$python_executable" -c "import sys; import os; print(os.path.dirname(sys.executable))")
openvds_path=$(realpath $openvds_path)
skbuild_platform="$skplat_name-$python_ver"
skbuild_dir="$openvds_path/_skbuild/$skbuild_platform"
build_dir="$openvds_path/_skbuild/internal_build_dir"
[[ -d $skbuild_dir ]] || mkdir -p $skbuild_dir
[[ -d $build_dir ]] || mkdir -p $build_dir
skbuild_dir=$(realpath $skbuild_dir)
build_dir=$(realpath $build_dir)
venv_dir="$openvds_path/_skbuild/venv_$python_ver"
$python_executable -m venv $venv_dir
if [[ "$platform_name" == "win" ]]; then
source $venv_dir/Scripts/activate
else
source $venv_dir/bin/activate
fi
python_executable=$(python -c "import sys; import os; print(sys.executable.replace(os.sep, '/'))")
$python_executable -m pip install -r $openvds_path/python/requirements-dev.txt
python_root_dir=$("$python_executable" -c "import sys; import os; print(os.path.dirname(sys.executable))")
cd "$build_dir"
echo "Do $python_executable to $skbuild_dir"
......
cmake_minimum_required(VERSION 3.16.0)
project(OpenVDSExamples)
if (CMAKE_PROJECT_NAME STREQUAL "OpenVDSExamples")
include(FetchContent)
macro(Fetch3rdParty_Package name version url url_hash)
set(Fetch3rdPartyDir "${PROJECT_SOURCE_DIR}/3rdparty")
get_filename_component(thirdParty "${Fetch3rdPartyDir}" ABSOLUTE)
set(SRC_DIR ${thirdParty}/${name}-${version})
set(${name}_SOURCE_DIR ${SRC_DIR})
set(${name}_VERSION ${version})
if (NOT (EXISTS ${SRC_DIR}))
FetchContent_Populate(${name}
URL ${url}
URL_HASH ${url_hash}
SOURCE_DIR ${SRC_DIR}
SUBBUILD_DIR ${thirdParty}/CMakeArtifacts/${name}-sub-${version}
BINARY_DIR ${thirdParty}/CMakeArtifacts/${name}-${version})
endif()
endmacro()
Fetch3rdParty_Package(cxxopts 3.0.0 https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.0.0.tar.gz SHA256=36f41fa2a46b3c1466613b63f3fa73dc24d912bc90d667147f1e43215a8c6d00)
set(COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common)
include(modules/InstalledPaths.cmake)
include(modules/SetWarnings.cmake)
......
......@@ -4,7 +4,7 @@ if (OpenMP_CXX_FOUND)
target_link_libraries(slicedump PRIVATE OpenMP::OpenMP_CXX)
endif()
set_target_properties(slicedump PROPERTIES FOLDER examples)
target_include_directories(slicedump PRIVATE ${COMMON_DIR})
target_include_directories(slicedump PRIVATE ${COMMON_DIR} ${cxxopts_SOURCE_DIR}/include)
setWarningFlagsForTarget(slicedump)
copyDllForTarget(slicedump)
This diff is collapsed.
......@@ -17,7 +17,7 @@
#define _CRT_SECURE_NO_WARNINGS 1
#include "cxxopts.hpp"
#include <cxxopts.hpp>
#include <stdio.h>
......
......@@ -1586,7 +1586,7 @@ JNIEXPORT void JNICALL Java_org_opengroup_openvds_GoogleOpenOptions_setCredentia
CPPJNI_TRY
{
auto pInstance = CPPJNI_cast<OpenVDS::GoogleOpenOptions>(native_handle);
pInstance->credentialsType = (enum OpenVDS::GoogleOpenOptions::CredentialsType)value;
pInstance->credentialsType = (OpenVDS::GoogleOpenOptions::CredentialsType)value;
}
CPPJNI_CATCH
}
......
......@@ -636,7 +636,9 @@ def transform_jni_functioncall_args(args: List[Param], is_static_method: bool=Fa
elif jnitype_ == "jboolean":
arglist.append(f"{name} ? true : false")
elif is_enum_type(arg):
if is_scoped_enum_type(arg):
# We want to avoid any clashes between function names and type names,
# so lets's be specific here:
if is_scoped_enum_type(arg) and not is_enum_class(arg):
arglist.append(f"(enum {type_}){name}")
else:
arglist.append(f"({type_}){name}")
......@@ -750,6 +752,12 @@ def is_enumset_type(arg: Param) -> bool:
return True
return False
def is_enum_class(arg: Param) -> bool:
t = find_enum_type(arg.canonical_type)
if t:
return t.is_enum_class
return False
def is_scoped_enum_type(arg: Param) -> bool:
t = find_enum_type(arg.canonical_type)
if t:
......
......@@ -344,7 +344,8 @@ class Scope(OrderedDict):
return children
@staticmethod
def _get_comment_from_file(filename: str, lineno: int):
def _get_line_from_file(filename: str, lineno: int):
assert isinstance(filename, str)
assert lineno > 0
lineno = lineno - 1
global _file_contents_dict
......@@ -357,12 +358,17 @@ class Scope(OrderedDict):
_file_contents_dict[filename] = []
contents = _file_contents_dict[filename]
if lineno < len(contents):
line = contents[lineno]
try:
return line[line.index('///'):]
except:
pass
return ''
return contents[lineno]
else:
return ''
@staticmethod
def _get_comment_from_file(filename: str, lineno: int):
line = Scope._get_line_from_file(filename, lineno)
if '///' in line:
return line[line.index('///'):]
else:
return ''
@staticmethod
def _get_comment(node) -> str:
......@@ -424,6 +430,16 @@ class Scope(OrderedDict):
def is_enum(self) -> bool:
return self.nodetype == 'ENUM_DECL'
@property
def is_enum_class(self) -> bool:
if self.is_enum:
# libclang cindex nodes do not distinguish between plain enums and enum classes,
# so we resort to this hack:
line = Scope._get_line_from_file(self.node.location.file.name, self.node.location.line)
if 'enum class' in line:
return True
return False
@property
def is_enum_value(self) -> bool:
return self.nodetype == 'ENUM_CONSTANT_DECL'
......
......@@ -9,6 +9,10 @@ set_target_properties(gtest PROPERTIES
set_target_properties(gtest_main PROPERTIES
FOLDER ExternalProjectTargets/GoogleTest)
string(REPLACE " " ";" DISABLE_WARNING_FLAG ${DISABLE_WARNING_FLAG})
target_compile_options(gtest PRIVATE ${DISABLE_WARNING_FLAG})
target_compile_options(gtest_main PRIVATE ${DISABLE_WARNING_FLAG})
add_executable(TestRootTarget RootTestExecutable.cpp)
set_target_properties(TestRootTarget PROPERTIES FOLDER tests)
copyDllForTarget(TestRootTarget)
......
......@@ -32,7 +32,7 @@ endif()
add_test(NAME "python.pytests.pytests"
COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=$<TARGET_FILE_DIR:core>/..${separator}${CMAKE_CURRENT_BINARY_DIR}${separator}$<TARGET_FILE_DIR:openvds_python_test>/..${separator}${CMAKE_CURRENT_SOURCE_DIR}"
${Python3_EXECUTABLE} -m pytest -s
${Python3_EXECUTABLE} -m pytest -s --junit-xml=${PROJECT_BINARY_DIR}/test_results/pytest_results.xml
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pytests
)
......
......@@ -13,7 +13,7 @@ function(setCompilerFlagsForTools target)
target_link_libraries(${target} PRIVATE tools_shared)
set_target_properties(${target} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib${LIBSUFFIX}")
target_include_directories(${target} PRIVATE ${TOOLS_FOLDER}/Shared ${COMMON_DIR})
target_include_directories(${target} PRIVATE ${TOOLS_FOLDER}/Shared ${COMMON_DIR} ${cxxopts_SOURCE_DIR}/include)
endfunction()
add_subdirectory(Shared)
......
......@@ -22,7 +22,7 @@
#include <OpenVDS/VolumeDataAccess.h>
#include <OpenVDS/VolumeDataLayout.h>
#include <cxxopts/cxxopts.hpp>
#include <cxxopts.hpp>
#include <cstdlib>
#include <climits>
......
......@@ -46,7 +46,7 @@
#define _USE_MATH_DEFINES
#include <math.h>
#include <cxxopts/cxxopts.hpp>
#include <cxxopts.hpp>
#include <json/json.h>
#include <fmt/format.h>
......
......@@ -3,7 +3,7 @@
#include <OpenVDS/OpenVDS.h>
#include <OpenVDS/VolumeDataLayout.h>
#include <cxxopts/cxxopts.hpp>
#include <cxxopts.hpp>
#include <ThreadPool/ThreadPool.h>
#include <PrintHelpers.h>
......
......@@ -7,7 +7,8 @@
#include <Base64/Base64.h>
#include <cxxopts/cxxopts.hpp>
#include <cxxopts.hpp>
#include <PrintHelpers.h>
#include <HelpConnection.h>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment