Skip to content

Commit

Permalink
cephfs-shell: Add tox for testing with flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
varshar16 authored and batrick committed Jul 30, 2019
1 parent 6015ff4 commit e90d582
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion run-make-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function run() {
BUILD_MAKEOPTS=${BUILD_MAKEOPTS:-$DEFAULT_MAKEOPTS}
test "$BUILD_MAKEOPTS" && echo "make will run with option(s) $BUILD_MAKEOPTS"
CHECK_MAKEOPTS=${CHECK_MAKEOPTS:-$DEFAULT_MAKEOPTS}
CMAKE_BUILD_OPTS="-DWITH_GTEST_PARALLEL=ON -DWITH_FIO=ON -DWITH_SEASTAR=ON"
CMAKE_BUILD_OPTS="-DWITH_GTEST_PARALLEL=ON -DWITH_FIO=ON -DWITH_SEASTAR=ON -DWITH_CEPHFS_SHELL=ON"
CMAKE_BUILD_OPTS+=$(detect_ceph_dev_pkgs)
cat <<EOM
Note that the binaries produced by this script do not contain correct time
Expand Down
7 changes: 7 additions & 0 deletions src/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,13 @@ if(WITH_MGR)
list(APPEND tox_tests run-tox-python-common)
endif()

if(WITH_CEPHFS_SHELL)
add_test(NAME run-tox-cephfs-shell COMMAND bash ${CMAKE_SOURCE_DIR}/src/tools/cephfs/run-tox.sh)
list(APPEND tox_tests run-tox-cephfs-shell)
set(CEPHFS_SHELL_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/cephfs-shell-virtualenv)
list(APPEND env_vars_for_tox_tests CEPHFS_SHELL_VIRTUALENV=${CEPHFS_SHELL_VIRTUALENV})
endif()

set_property(
TEST ${tox_tests}
PROPERTY ENVIRONMENT ${env_vars_for_tox_tests})
Expand Down
9 changes: 5 additions & 4 deletions src/tools/cephfs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ install(TARGETS
option(WITH_CEPHFS_SHELL "install cephfs-shell" OFF)
if(WITH_CEPHFS_SHELL)
if(NOT WITH_PYTHON3)
message(SEND_ERROR "Please enable WITH_PYTHON3 for cephfs-shell")
message(WARNING "Please enable WITH_PYTHON3 for cephfs-shell")
else()
include(Distutils)
distutils_install_module(cephfs-shell
PYTHON_VERSION 3)
endif()
include(Distutils)
distutils_install_module(cephfs-shell
PYTHON_VERSION 3)
endif()
10 changes: 10 additions & 0 deletions src/tools/cephfs/run-tox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
TOX_PATH=${CEPH_ROOT}/src/tools/cephfs/tox.ini
CEPHFS=${CEPH_ROOT}/src/tools/cephfs

tox -c ${TOX_PATH} -e flake8
TOX_STATUS="$?"
test "$TOX_STATUS" -ne "0"
rm -rf ${CEPHFS}/.tox/
rm -rf ${CEPHFS}/cephfs_shell.egg-info/
exit $TOX_STATUS
6 changes: 6 additions & 0 deletions src/tools/cephfs/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[tox]
skipsdist = true

[testenv:flake8]
deps = flake8
commands = flake8 --ignore=W503 --max-line-length=100 cephfs-shell

0 comments on commit e90d582

Please sign in to comment.