]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/fio: enable objectstore FIO plugin building without the need to install and...
authorIgor Fedotov <ifedotov@suse.com>
Wed, 21 Feb 2018 12:03:23 +0000 (15:03 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Mon, 5 Mar 2018 17:35:08 +0000 (20:35 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
CMakeLists.txt
cmake/modules/BuildFIO.cmake [new file with mode: 0644]
cmake/modules/Findfio.cmake
run-make-check.sh
src/test/CMakeLists.txt
src/test/fio/CMakeLists.txt
src/test/fio/README.md

index c8f5d20d041e5336a62f81f6ddba576daffd8efc..ebba09c2e8cddd635e02cad9d30e7c78944a8609 100644 (file)
@@ -499,10 +499,16 @@ option(PG_DEBUG_REFS "PG Ref debugging is enabled" OFF)
 
 option(WITH_TESTS "enable the build of ceph-test package scripts/binaries" ON)
 
-option(WITH_FIO "Support for fio engines" OFF)
-if(WITH_FIO)
+# fio
+option(WITH_FIO "build with fio plugin enabled" OFF)
+option(WITH_SYSTEM_FIO "require and build with system fio" OFF)
+if(WITH_SYSTEM_FIO)
   find_package(fio REQUIRED)
-endif(WITH_FIO)
+elseif(WITH_FIO)
+  set(FIO_INCLUDE_DIR ${CMAKE_BINARY_DIR}/src/fio)
+  include(BuildFIO)
+  build_fio()
+endif()
 
 if(LINUX)
   add_definitions(-D__linux__)
diff --git a/cmake/modules/BuildFIO.cmake b/cmake/modules/BuildFIO.cmake
new file mode 100644 (file)
index 0000000..973063e
--- /dev/null
@@ -0,0 +1,15 @@
+function(build_fio)
+  # we use an external project and copy the sources to bin directory to ensure
+  # that object files are built outside of the source tree.
+  include(ExternalProject)
+  ExternalProject_Add(fio_ext
+    DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/src/
+    UPDATE_COMMAND "" # this disables rebuild on each run
+    GIT_REPOSITORY "https://github.com/axboe/fio.git"
+    GIT_TAG "fio-3.5"
+    SOURCE_DIR ${CMAKE_BINARY_DIR}/src/fio
+    BUILD_IN_SOURCE 1
+    CONFIGURE_COMMAND <SOURCE_DIR>/configure
+    BUILD_COMMAND $(MAKE) fio EXTFLAGS=-Wno-format-truncation
+    INSTALL_COMMAND cp <BINARY_DIR>/fio ${CMAKE_BINARY_DIR}/bin)
+endfunction()
index 194f9191b00d7c49305786e3e329cd56fed7a3b4..ec91ca5aaccb4bfd78610b4b9d85bd8dae05f43a 100644 (file)
@@ -4,7 +4,7 @@
 # FIO_INCLUDE_DIR - where to find fio.h
 # FIO_FOUND - True if fio is found.
 
-find_path(FIO_INCLUDE_DIR NAMES fio.h HINTS ${FIO_ROOT_DIR})
+find_path(FIO_INCLUDE_DIR NAMES fio.h HINTS ENV FIO_ROOT_DIR)
 
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(fio DEFAULT_MSG FIO_INCLUDE_DIR)
index 72583a1e841526c5aff2068f7fe4ac3fb06b4350..26c5c9567cb001030e25b1a9153e19d169519d5b 100755 (executable)
@@ -68,7 +68,7 @@ function run() {
     BUILD_MAKEOPTS=${BUILD_MAKEOPTS:-$DEFAULT_MAKEOPTS}
     CHECK_MAKEOPTS=${CHECK_MAKEOPTS:-$DEFAULT_MAKEOPTS}
 
-    $DRY_RUN ./do_cmake.sh $@ || return 1
+    $DRY_RUN ./do_cmake.sh -DWITH_FIO=ON $@ || return 1
     $DRY_RUN cd build
     $DRY_RUN make $BUILD_MAKEOPTS tests || return 1
     # prevent OSD EMFILE death on tests, make sure large than 1024
index 54886b382d2205c368268f1b8c1ed485bfce0912..73ba50ee1519a132b143c0a342be18fa5f4e1a0c 100644 (file)
@@ -59,7 +59,7 @@ if(WITH_RBD)
   add_subdirectory(rbd_mirror)
 endif(WITH_RBD)
 add_subdirectory(system)
-if(WITH_FIO)
+if(WITH_FIO OR WITH_SYSTEM_FIO)
   add_subdirectory(fio)
 endif()
 
index 858ab08e60ada3316b75a06a0d969fb20536df36..bce6cfd222d46845747042f132976678c1c577e1 100644 (file)
@@ -14,5 +14,8 @@ else()
     COMPILE_FLAGS "${FIO_CFLAGS}")
 endif()
 
+if(WITH_FIO)
+  add_dependencies(fio_ceph_objectstore fio_ext)
+endif()
 target_link_libraries(fio_ceph_objectstore os global)
 install(TARGETS fio_ceph_objectstore DESTINATION lib)
index 05c54442cc1a0a04c0c1d5a7677ba713c14b4373..13a6dcf06bb81f6fde857f876b81df0c76d6f9e7 100644 (file)
@@ -49,12 +49,19 @@ Because the ObjectStore is not a public-facing interface, we build it inside
 of the ceph tree and load libfio_ceph_objectstore.so into fio as an external
 engine.
 
-To build fio_ceph_objectstore:
+To build fio_ceph_objectstore against external(downloadable) FIO source code:
 ```
-  mkdir build && cd build
-  cmake -DWITH_FIO=ON -DFIO_INCLUDE_DIR=/path/to/fio -DCMAKE_BUILD_TYPE=Release /path/to/ceph
-  make -C src/test/fio install
+  ./do_cmake.sh -DWITH_FIO=ON -DCMAKE_BUILD_TYPE=Release
+  cd build
+  make fio_ceph_objectstore install
 ```
+To build against existing FIO source code:
+```
+  FIO_ROOT_DIR=<path to fio source code> ./do_cmake.sh -DWITH_SYSTEM_FIO=ON
+  cd build
+  make fio_ceph_objectstore install
+```
+
 If you install the ceph libraries to a location that isn't in your
 LD_LIBRARY_PATH, be sure to add it: