The branch, master has been updated via 2b486d5 Drop support for Python 2 via 7932e58 gitlab-ci: Introduce test stages via 1c924d4 gitlab-ci: Change the obj-dir so it doesn't create problems via 514610b gitlab-ci: Fix indentation found by yamllint from d938a84 Bump version to 1.1.4
https://git.samba.org/?p=pam_wrapper.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 2b486d5eb124562460a91e49eaf7bbef6fd3d168 Author: Andreas Schneider <a...@samba.org> Date: Tue Aug 2 09:21:55 2022 +0200 Drop support for Python 2 Python 2 is already EOL! Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 7932e582ec0e4332ee417fbddfab3516e9ed575a Author: Andreas Schneider <a...@samba.org> Date: Tue Aug 2 11:45:05 2022 +0200 gitlab-ci: Introduce test stages Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> commit 1c924d44443eb8f9065145c256a2e796069563e4 Author: Andreas Schneider <a...@samba.org> Date: Tue Aug 2 11:55:02 2022 +0200 gitlab-ci: Change the obj-dir so it doesn't create problems The artifacts seem to be downloaded in the analysis stage if something fails in the test stage. This should fix it for now. Reviewed-by: Ralph Boehme <s...@samba.org> commit 514610bcc4a8825b36cbbb838c496657e0b99bef Author: Andreas Schneider <a...@samba.org> Date: Tue Aug 2 11:40:42 2022 +0200 gitlab-ci: Fix indentation found by yamllint Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Ralph Boehme <s...@samba.org> ----------------------------------------------------------------------- Summary of changes: .gitlab-ci.yml | 209 +++++++++++++++++++++----------------- src/python/CMakeLists.txt | 3 +- src/python/python2/CMakeLists.txt | 45 -------- tests/CMakeLists.txt | 9 -- tests/pypamtest_test.py | 14 +-- 5 files changed, 121 insertions(+), 159 deletions(-) delete mode 100644 src/python/python2/CMakeLists.txt Changeset truncated at 500 lines: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1439b2c..c205528 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,4 @@ +--- variables: GIT_DEPTH: 3 BUILD_IMAGES_PROJECT: cmocka/gitlab-build-images @@ -6,18 +7,24 @@ variables: TUMBLEWEED_BUILD: buildenv-tumbleweed UBUNTU_BUILD: buildenv-ubuntu +stages: + - build + - test + - analysis + centos7/x86_64: + stage: test image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$CENTOS7_BUILD script: - - mkdir -p obj && cd obj && cmake3 - -DCMAKE_BUILD_TYPE=RelWithDebInfo - -DPICKY_DEVELOPER=ON - -DUNIT_TESTING=ON .. && - make -j$(nproc) && ctest --output-on-failure + - mkdir -p obj && cd obj && cmake3 + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DPICKY_DEVELOPER=ON + -DUNIT_TESTING=ON .. && + make -j$(nproc) && ctest --output-on-failure tags: - - shared + - shared except: - - tags + - tags artifacts: expire_in: 1 week when: on_failure @@ -25,18 +32,19 @@ centos7/x86_64: - obj/ fedora/x86_64: + stage: test image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD script: - - mkdir -p obj && cd obj && cmake - -DCMAKE_INSTALL_PREFIX=/tmp/local - -DCMAKE_BUILD_TYPE=RelWithDebInfo - -DPICKY_DEVELOPER=ON - -DUNIT_TESTING=ON .. && - make -j$(nproc) && ctest --output-on-failure && make install + - mkdir -p obj && cd obj && cmake + -DCMAKE_INSTALL_PREFIX=/tmp/local + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DPICKY_DEVELOPER=ON + -DUNIT_TESTING=ON .. && + make -j$(nproc) && ctest --output-on-failure && make install tags: - - shared + - shared except: - - tags + - tags artifacts: expire_in: 1 week when: on_failure @@ -44,17 +52,18 @@ fedora/x86_64: - obj/ fedora/address-sanitizer: + stage: build image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD script: - - mkdir -p obj && cd obj && cmake - -DCMAKE_BUILD_TYPE=AddressSanitizer - -DPICKY_DEVELOPER=ON - -DUNIT_TESTING=ON .. && - make -j$(nproc) && ctest --output-on-failure + - mkdir -p obj && cd obj && cmake + -DCMAKE_BUILD_TYPE=AddressSanitizer + -DPICKY_DEVELOPER=ON + -DUNIT_TESTING=ON .. && + make -j$(nproc) && ctest --output-on-failure tags: - - shared + - shared except: - - tags + - tags artifacts: expire_in: 1 week when: on_failure @@ -62,17 +71,18 @@ fedora/address-sanitizer: - obj/ fedora/undefined-sanitizer: + stage: analysis image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD script: - - mkdir -p obj && cd obj && cmake - -DCMAKE_BUILD_TYPE=UndefinedSanitizer - -DPICKY_DEVELOPER=ON - -DUNIT_TESTING=ON .. - && make -j$(nproc) && ctest --output-on-failure + - mkdir -p obj && cd obj && cmake + -DCMAKE_BUILD_TYPE=UndefinedSanitizer + -DPICKY_DEVELOPER=ON + -DUNIT_TESTING=ON .. + && make -j$(nproc) && ctest --output-on-failure tags: - - shared + - shared except: - - tags + - tags artifacts: expire_in: 1 week when: on_failure @@ -80,32 +90,33 @@ fedora/undefined-sanitizer: - obj/ fedora/csbuild: + stage: analysis variables: GIT_DEPTH: 20 image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD script: - - | - if [[ -z "$CI_COMMIT_BEFORE_SHA" ]]; then - export CI_COMMIT_BEFORE_SHA=$(git rev-parse "${CI_COMMIT_SHA}~15") - fi + - | + if [[ -z "$CI_COMMIT_BEFORE_SHA" ]]; then + export CI_COMMIT_BEFORE_SHA=$(git rev-parse "${CI_COMMIT_SHA}~15") + fi - # Check if the commit exists in this branch - # This is not the case for a force push - git branch --contains $CI_COMMIT_BEFORE_SHA 2>/dev/null || export CI_COMMIT_BEFORE_SHA=$(git rev-parse "${CI_COMMIT_SHA}~15") + # Check if the commit exists in this branch + # This is not the case for a force push + git branch --contains $CI_COMMIT_BEFORE_SHA 2>/dev/null || export CI_COMMIT_BEFORE_SHA=$(git rev-parse "${CI_COMMIT_SHA}~15") - export CI_COMMIT_RANGE="$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA" + export CI_COMMIT_RANGE="$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA" - - csbuild - --build-dir=obj-csbuild - --prep-cmd="cmake -DCMAKE_BUILD_TYPE=Debug -DPICKY_DEVELOPER=ON -DUNIT_TESTING=ON @SRCDIR@" - --build-cmd "make clean && make -j$(nproc)" - --git-commit-range $CI_COMMIT_RANGE - --color - --print-current --print-fixed + - csbuild + --build-dir=obj-csbuild + --prep-cmd="cmake -DCMAKE_BUILD_TYPE=Debug -DPICKY_DEVELOPER=ON -DUNIT_TESTING=ON @SRCDIR@" + --build-cmd "make clean && make -j$(nproc)" + --git-commit-range $CI_COMMIT_RANGE + --color + --print-current --print-fixed tags: - - shared + - shared except: - - tags + - tags artifacts: expire_in: 1 week when: on_failure @@ -113,41 +124,43 @@ fedora/csbuild: - obj-csbuild/ freebsd/x86_64: + stage: test image: script: - - mkdir -p obj && cd obj && cmake - -DCMAKE_BUILD_TYPE=RelWithDebInfo - -DPICKY_DEVELOPER=ON - -DUNIT_TESTING=ON .. && - make && ctest --output-on-failure + - mkdir -p obj-freebsd && cd obj-freebsd && cmake + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DPICKY_DEVELOPER=ON + -DUNIT_TESTING=ON .. && + make && ctest --output-on-failure tags: - - freebsd + - freebsd except: - - tags + - tags only: - - branches@cwrap/pam_wrapper - - branches@cryptomilk/pam_wrapper + - branches@cwrap/pam_wrapper + - branches@cryptomilk/pam_wrapper artifacts: expire_in: 1 week when: on_failure paths: - - obj/ + - obj-freebsd/ # pam_wrapper stopped to work with the latest OpenPAM version, this is a # bigger effort to investigate. allow_failure: true tumbleweed/x86_64/gcc: + stage: test image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD script: - - mkdir -p obj && cd obj && cmake - -DCMAKE_BUILD_TYPE=RelWithDebInfo - -DPICKY_DEVELOPER=ON - -DUNIT_TESTING=ON .. && - make -j$(nproc) && ctest --output-on-failure + - mkdir -p obj && cd obj && cmake + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DPICKY_DEVELOPER=ON + -DUNIT_TESTING=ON .. && + make -j$(nproc) && ctest --output-on-failure tags: - - shared + - shared except: - - tags + - tags artifacts: expire_in: 1 week when: on_failure @@ -155,18 +168,19 @@ tumbleweed/x86_64/gcc: - obj/ tumbleweed/x86_64/gcc7: + stage: test image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD script: - - mkdir -p obj && cd obj && cmake - -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7 - -DCMAKE_BUILD_TYPE=RelWithDebInfo - -DPICKY_DEVELOPER=ON - -DUNIT_TESTING=ON .. && - make -j$(nproc) && ctest --output-on-failure + - mkdir -p obj && cd obj && cmake + -DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7 + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DPICKY_DEVELOPER=ON + -DUNIT_TESTING=ON .. && + make -j$(nproc) && ctest --output-on-failure tags: - - shared + - shared except: - - tags + - tags artifacts: expire_in: 1 week when: on_failure @@ -176,18 +190,19 @@ tumbleweed/x86_64/gcc7: # PICKY_DEVELOPER IS OFF # => https://github.com/python/cpython/pull/19133 tumbleweed/x86_64/clang: + stage: test image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD script: - - mkdir -p obj && cd obj && cmake - -DCMAKE_BUILD_TYPE=RelWithDebInfo - -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ - -DPICKY_DEVELOPER=OFF - -DUNIT_TESTING=ON .. && - make -j$(nproc) && ctest --output-on-failure + - mkdir -p obj && cd obj && cmake + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + -DPICKY_DEVELOPER=OFF + -DUNIT_TESTING=ON .. && + make -j$(nproc) && ctest --output-on-failure tags: - - shared + - shared except: - - tags + - tags artifacts: expire_in: 1 week when: on_failure @@ -197,20 +212,21 @@ tumbleweed/x86_64/clang: # PICKY_DEVELOPER IS OFF # => https://github.com/python/cpython/pull/19133 tumbleweed/static-analysis: + stage: analysis image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD script: - - export CCC_CC=clang - - export CCC_CXX=clang++ - - mkdir -p obj && cd obj && scan-build cmake - -DCMAKE_BUILD_TYPE=Debug - -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ - -DPICKY_DEVELOPER=OFF - -DUNIT_TESTING=ON .. && - scan-build --status-bugs -o scan make -j$(nproc) + - export CCC_CC=clang + - export CCC_CXX=clang++ + - mkdir -p obj && cd obj && scan-build cmake + -DCMAKE_BUILD_TYPE=Debug + -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + -DPICKY_DEVELOPER=OFF + -DUNIT_TESTING=ON .. && + scan-build --status-bugs -o scan make -j$(nproc) tags: - - shared + - shared except: - - tags + - tags artifacts: expire_in: 1 week when: on_failure @@ -218,17 +234,18 @@ tumbleweed/static-analysis: - obj/scan ubuntu/x86_64: + stage: test image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$UBUNTU_BUILD script: - - mkdir -p obj && cd obj && cmake - -DCMAKE_BUILD_TYPE=RelWithDebInfo - -DPICKY_DEVELOPER=ON - -DUNIT_TESTING=ON .. && - make -j$(nproc) && ctest --output-on-failure + - mkdir -p obj && cd obj && cmake + -DCMAKE_BUILD_TYPE=RelWithDebInfo + -DPICKY_DEVELOPER=ON + -DUNIT_TESTING=ON .. && + make -j$(nproc) && ctest --output-on-failure tags: - - shared + - shared except: - - tags + - tags artifacts: expire_in: 1 week when: on_failure diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index faaf569..3d8ec92 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -1,10 +1,9 @@ project(pypamtest C) -add_subdirectory(python2) add_subdirectory(python3) if (WITH_WNO_CAST_FUNCTION_TYPE) set_source_files_properties(pypamtest.c - DIRECTORY python2 python3 + DIRECTORY python3 PROPERTIES COMPILE_OPTIONS "-Wno-cast-function-type") endif() diff --git a/src/python/python2/CMakeLists.txt b/src/python/python2/CMakeLists.txt deleted file mode 100644 index d0b0ed2..0000000 --- a/src/python/python2/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -project(python2-pamtest C) - -if (NOT PYTHON2_LIBRARY) - unset(PYTHON_EXECUTABLE CACHE) - unset(PYTHON_INCLUDE_DIR CACHE) - unset(PYTHON_LIBRARY CACHE) - unset(PYTHON_SITELIB CACHE) - unset(PYTHONLIBS_FOUND CACHE) - unset(PYTHONLIBS_VERSION_STRING CACHE) - - find_package(PythonLibs 2) - find_package(PythonInterp 2) - find_package(PythonSiteLibs 2) - - if (PYTHONLIBS_FOUND) - set(PYTHON2_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "PYTHON2_EXECUTABLE") - set(PYTHON2_INCLUDE_DIR ${PYTHON_INCLUDE_DIR}) - set(PYTHON2_LIBRARY ${PYTHON_LIBRARY}) - set(PYTHON2_SITELIB ${PYTHON_SITELIB}) - endif() - - unset(PYTHON_EXECUTABLE CACHE) - unset(PYTHON_INCLUDE_DIR CACHE) - unset(PYTHON_LIBRARY CACHE) - unset(PYTHON_SITELIB CACHE) - unset(PYTHONLIBS_FOUND CACHE) - unset(PYTHONLIBS_VERSION_STRING CACHE) -endif() - -if (PYTHON2_INCLUDE_DIR AND PYTHON2_LIBRARY AND PYTHON2_SITELIB) - include_directories(${CMAKE_BINARY_DIR}) - include_directories(${pam_wrapper-headers_DIR}) - include_directories(${PYTHON2_INCLUDE_DIR}) - - python_add_module(python2-pamtest ${pypamtest_SOURCE_DIR}/pypamtest.c) - target_link_libraries(python2-pamtest pamtest::pamtest ${PYTHON2_LIBRARY}) - target_compile_options(python2-pamtest - PRIVATE ${DEFAULT_C_COMPILE_FLAGS}) - set_target_properties(python2-pamtest PROPERTIES OUTPUT_NAME "pypamtest") - - install(TARGETS - python2-pamtest - DESTINATION - ${CMAKE_INSTALL_PREFIX}/${PYTHON2_SITELIB}) -endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index de8da05..9d56f21 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -90,15 +90,6 @@ if (CMAKE_BUILD_TYPE) endif() if (RUN_PYTHON_TESTS) - if (PYTHON2_EXECUTABLE) - add_test(NAME - py2pamtest_test - COMMAND - ${PYTHON2_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pypamtest_test.py) - - add_cmocka_test_environment(py2pamtest_test) - endif() - if (PYTHON3_EXECUTABLE) add_test(NAME py3pamtest_test diff --git a/tests/pypamtest_test.py b/tests/pypamtest_test.py index d49a110..57fa2cd 100755 --- a/tests/pypamtest_test.py +++ b/tests/pypamtest_test.py @@ -20,7 +20,7 @@ class PyPamTestImport(unittest.TestCase): if sys.hexversion >= 0x3000000: self.modpath = os.path.join(os.getcwd(), "../src/python/python3") else: - self.modpath = os.path.join(os.getcwd(), "../src/python/python2") + self.assertTrue(False) self.system_path = sys.path[:] sys.path = [ self.modpath ] @@ -142,12 +142,12 @@ class PyPamTestRunTest(unittest.TestCase): neo_password = "wrong_secret" tc = pypamtest.TestCase(pypamtest.PAMTEST_AUTHENTICATE) - self.assertRaisesRegexp(pypamtest.PamTestError, - "Error \[2\]: Test case { pam_operation \[0\] " - "expected_rv \[0\] flags \[0\] } " - "returned \[\d\]", - pypamtest.run_pamtest, - "neo", "matrix_py", [tc], [ neo_password ]) + self.assertRaisesRegex(pypamtest.PamTestError, + "Error \[2\]: Test case { pam_operation \[0\] " + "expected_rv \[0\] flags \[0\] } " + "returned \[\d\]", + pypamtest.run_pamtest, + "neo", "matrix_py", [tc], [ neo_password ]) if __name__ == "__main__": error = 0 -- pam wrapper repository