]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-shell: Add tox for testing with flake8 28239/head
authorVarsha Rao <varao@redhat.com>
Fri, 24 May 2019 13:15:16 +0000 (18:45 +0530)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 30 Jul 2019 17:34:24 +0000 (10:34 -0700)
Fixes: https://tracker.ceph.com/issues/39947
Signed-off-by: Varsha Rao <varao@redhat.com>
run-make-check.sh
src/test/CMakeLists.txt
src/tools/cephfs/CMakeLists.txt
src/tools/cephfs/run-tox.sh [new file with mode: 0644]
src/tools/cephfs/tox.ini [new file with mode: 0644]

index eb9232c87f5091551df905443bf42042d5ada46a..12360cda8953c6deb0ae0f01dc6b311119c3237f 100755 (executable)
@@ -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
index 04762e980e0ad71e0458ba9a22d17df20abbaedc..7ac965a90e485008db94a6ec41272c1d01d3082d 100644 (file)
@@ -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})
index 6ffa26628f1a48ed80e107d2a76cd36eab9a2041..de23878b1814812bc1d6e08c82504db0b354c844 100644 (file)
@@ -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()
diff --git a/src/tools/cephfs/run-tox.sh b/src/tools/cephfs/run-tox.sh
new file mode 100644 (file)
index 0000000..070865d
--- /dev/null
@@ -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
diff --git a/src/tools/cephfs/tox.ini b/src/tools/cephfs/tox.ini
new file mode 100644 (file)
index 0000000..147b114
--- /dev/null
@@ -0,0 +1,6 @@
+[tox]
+skipsdist = true
+
+[testenv:flake8]
+deps = flake8
+commands = flake8 --ignore=W503 --max-line-length=100 cephfs-shell