]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: add --{show_,}path to ceph_erasure_code_non_regression
authorLoic Dachary <ldachary@redhat.com>
Sun, 31 May 2015 11:11:34 +0000 (13:11 +0200)
committerLoic Dachary <ldachary@redhat.com>
Sat, 6 Jun 2015 22:15:05 +0000 (00:15 +0200)
The directory in which the payload is stored is created from the plugin
parameters. The --show-path shows the directory and exits. This
directory can then be used with --path to override the path created from
the plugin parameters. This is useful to verifying that the jerasure
variant optimized with AVX, SSE4 etc. instructions can be used on the
same payload and show no difference at all. In this case the directory
used by the default jerasure variant is used for each variant and the
parameter that sets the variant to use ( --parameters jerasure-variant )
must not be taken into account to figure out the location of the
payload.

http://tracker.ceph.com/issues/9720 Refs: #9720

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/test/erasure-code/ceph_erasure_code_non_regression.cc

index 8f8924f6da3e2abb12cb6ce11321eaa3a7f4abeb..222d174f947aa3548472f66d6abba1f1e894bd98 100644 (file)
@@ -3,7 +3,7 @@
 /*
  * Ceph distributed storage system
  *
- * Red Hat (C) 2014 Red Hat <contact@redhat.com>
+ * Red Hat (C) 2014, 2015 Red Hat <contact@redhat.com>
  *
  * Author: Loic Dachary <loic@dachary.org>
  *
@@ -39,12 +39,14 @@ class ErasureCodeNonRegression {
   string plugin;
   bool create;
   bool check;
+  bool show_path;
   string base;
   string directory;
   ErasureCodeProfile profile;
 public:
   int setup(int argc, char** argv);
   int run();
+  int run_show_path();
   int run_create();
   int run_check();
   int decode_erasures(ErasureCodeInterfaceRef erasure_code,
@@ -67,6 +69,8 @@ int ErasureCodeNonRegression::setup(int argc, char** argv) {
      "prefix all paths with base")
     ("parameter,P", po::value<vector<string> >(),
      "add a parameter to the erasure code profile")
+    ("path", po::value<string>(), "content path instead of inferring it from parameters")
+    ("show-path", "display the content path and exit")
     ("create", "create the erasure coded content in the directory")
     ("check", "check the content in the directory matches the chunks and vice versa")
     ;
@@ -106,9 +110,10 @@ int ErasureCodeNonRegression::setup(int argc, char** argv) {
   base = vm["base"].as<string>();
   check = vm.count("check") > 0;
   create = vm.count("create") > 0;
+  show_path = vm.count("show-path") > 0;
 
-  if (!check && !create) {
-    cerr << "must specifify either --check or --create" << endl;
+  if (!check && !create && !show_path) {
+    cerr << "must specifify either --check, --create or --show-path" << endl;
     return 1;
   }
 
@@ -134,6 +139,10 @@ int ErasureCodeNonRegression::setup(int argc, char** argv) {
        directory += " " + *i;
     }
   }
+
+  if (vm.count("path"))
+    directory = vm["path"].as<string>();
+
   if (profile.count("directory") == 0)
     profile["directory"] = ".libs";
 
@@ -147,9 +156,17 @@ int ErasureCodeNonRegression::run()
     return ret;
   if(check && (ret = run_check()))
     return ret;
+  if(show_path && (ret = run_show_path()))
+    return ret;
   return ret;
 }
 
+int ErasureCodeNonRegression::run_show_path()
+{
+  cout << directory << endl;
+  return 0;
+}
+
 int ErasureCodeNonRegression::run_create()
 {
   ErasureCodePluginRegistry &instance = ErasureCodePluginRegistry::instance();