On Mon, Nov 26, 2012 at 6:50 AM, Mike Qiu <[email protected]> wrote:
> Currently, the scripts dir has change from virt/scripts to virt/shared/
> scripts. This make the test fail.
>
> Change it to correct dir
>
> Signed-off-by: Mike Qiu <[email protected]>
> ---
>  kvm/tests/ksm_overcommit.py |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kvm/tests/ksm_overcommit.py b/kvm/tests/ksm_overcommit.py
> index cd31b7e..0c7d3f1 100644
> --- a/kvm/tests/ksm_overcommit.py
> +++ b/kvm/tests/ksm_overcommit.py
> @@ -596,8 +596,8 @@ def run_ksm_overcommit(test, params, env):
>      logging.debug(utils_test.get_memory_info(lvms))
>
>      # Copy ksm_overcommit_guest.py into guests
> -    virt_dir = os.path.join(os.environ['AUTODIR'], 'virt')
> -    vksmd_src = os.path.join(virt_dir, "scripts", "ksm_overcommit_guest.py")
> +    virt_dir = os.path.join(os.environ['AUTODIR'], 'tests/virt')
> +    vksmd_src = os.path.join(virt_dir, "shared/scripts", 
> "ksm_overcommit_guest.py")

There's a better way to do this. We have the new data_dir API, that
can retrieve the shared path easily, and also works on both autotest
and the standalone test runner, it's something like this:

diff --git a/kvm/tests/ksm_overcommit.py b/kvm/tests/ksm_overcommit.py
index cd31b7e..9ed6464 100644
--- a/kvm/tests/ksm_overcommit.py
+++ b/kvm/tests/ksm_overcommit.py
@@ -1,8 +1,7 @@
 import logging, time, random, math, os
 from autotest.client.shared import error
 from autotest.client import utils
-from virttest import utils_misc, utils_test, aexpect
-from virttest import env_process
+from virttest import utils_misc, utils_test, aexpect, env_process, data_dir


 def run_ksm_overcommit(test, params, env):
@@ -596,8 +595,8 @@ def run_ksm_overcommit(test, params, env):
     logging.debug(utils_test.get_memory_info(lvms))

     # Copy ksm_overcommit_guest.py into guests
-    virt_dir = os.path.join(os.environ['AUTODIR'], 'virt')
-    vksmd_src = os.path.join(virt_dir, "scripts", "ksm_overcommit_guest.py")
+    shared_dir = os.path.dirname(data_dir.get_data_dir())
+    vksmd_src = os.path.join(shared_dir, "scripts", "ksm_overcommit_guest.py")
     dst_dir = "/tmp"
     for vm in lvms:
         vm.copy_files_to(vksmd_src, dst_dir)

I'm sending another patch with this approach, and will apply to next.

Cheers,

Lucas

>      dst_dir = "/tmp"
>      for vm in lvms:
>          vm.copy_files_to(vksmd_src, dst_dir)
> --
> 1.7.7.6
>



-- 
Lucas

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to