The issue of CWD of scripts loaded by ldtprunner

View: New views
5 Messages — Rating Filter:   Alert me  

The issue of CWD of scripts loaded by ldtprunner

by Wang Qi, Scott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, Nagappan,

I followed the ldtp-tutorial and created a ldtprunner XML file named 'run.xml'. The XML file loaded a script named 'test.py' successfully.

In 'test.py', I loaded a ldtp Data XML file as follows. But I found that the 'data.xml' must reside in the same directory as 'run.xml'.

dataXml = ldtputils.LdtpDataFileParser ('data.xml')


It causes some difficulites in arranging the ldtprunner xml files. We may have mutilple runner xml files comming from different directories to load the same 'test.py'.  It forbid we write a hardcoded path for 'data.xml'.
1) One solution is to use a flat directory structure. But it is too unnatural.
2) The other is to use os.getcwd() and os.chcwd() to change the working directory. But it seems I can't use '__file__' macro to get the current executing file's path information resolved.

Is there a better solution or hack available?

(It seems ldtp 1.7.1's ldtprunner implementation use 'execfile' to run the loaded script. I am not sure if there is another other standard method to solve the above issue)

Thanks
Scott Wang



_______________________________________________
LDTP-dev mailing list
LDTP-dev@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev

Re: The issue of CWD of scripts loaded by ldtprunner

by Nagappan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Scott,

On Thu, Sep 17, 2009 at 4:21 AM, Wang Qi, Scott <wangqi.s@...> wrote:
Hi, Nagappan,

I followed the ldtp-tutorial and created a ldtprunner XML file named 'run.xml'. The XML file loaded a script named 'test.py' successfully.

In 'test.py', I loaded a ldtp Data XML file as follows. But I found that the 'data.xml' must reside in the same directory as 'run.xml'.

dataXml = ldtputils.LdtpDataFileParser ('data.xml')


It causes some difficulites in arranging the ldtprunner xml files. We may have mutilple runner xml files comming from different directories to load the same 'test.py'.  It forbid we write a hardcoded path for 'data.xml'.
1) One solution is to use a flat directory structure. But it is too unnatural.

Sorry, when I designed, just thought the files will be on current working directory :)

 
2) The other is to use os.getcwd() and os.chcwd() to change the working directory. But it seems I can't use '__file__' macro to get the current executing file's path information resolved.

Is there a better solution or hack available?

The GNOME Desktop Testing team uses the LDTP API for automation and they have written their own version something similar or better than ldtprunner :) In the mean time, let me try to fix this as well.

Thanks
Nagappan

(It seems ldtp 1.7.1's ldtprunner implementation use 'execfile' to run the loaded script. I am not sure if there is another other standard method to solve the above issue)

Thanks
Scott Wang



_______________________________________________
LDTP-dev mailing list
LDTP-dev@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev




--
Linux Desktop (GUI Application) Testing Project - http://ldtp.freedesktop.org
http://nagappanal.blogspot.com

_______________________________________________
LDTP-dev mailing list
LDTP-dev@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev

Re: The issue of CWD of scripts loaded by ldtprunner

by Wang Qi, Scott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, Nagappan,

Thanks for the quick reply.

I will use some temp solutions. I do hope to see possible improvement in the future LDTP release. Thanks for the already-very-helping effort!

Best Regards
Scott Wang

On Fri, Sep 18, 2009 at 10:55 AM, Nagappan Alagappan <nagappan@...> wrote:
Hi Scott,

On Thu, Sep 17, 2009 at 4:21 AM, Wang Qi, Scott <wangqi.s@...> wrote:
Hi, Nagappan,

I followed the ldtp-tutorial and created a ldtprunner XML file named 'run.xml'. The XML file loaded a script named 'test.py' successfully.

In 'test.py', I loaded a ldtp Data XML file as follows. But I found that the 'data.xml' must reside in the same directory as 'run.xml'.

dataXml = ldtputils.LdtpDataFileParser ('data.xml')


It causes some difficulites in arranging the ldtprunner xml files. We may have mutilple runner xml files comming from different directories to load the same 'test.py'.  It forbid we write a hardcoded path for 'data.xml'.
1) One solution is to use a flat directory structure. But it is too unnatural.

Sorry, when I designed, just thought the files will be on current working directory :)

 
2) The other is to use os.getcwd() and os.chcwd() to change the working directory. But it seems I can't use '__file__' macro to get the current executing file's path information resolved.

Is there a better solution or hack available?

The GNOME Desktop Testing team uses the LDTP API for automation and they have written their own version something similar or better than ldtprunner :) In the mean time, let me try to fix this as well.

Thanks
Nagappan

(It seems ldtp 1.7.1's ldtprunner implementation use 'execfile' to run the loaded script. I am not sure if there is another other standard method to solve the above issue)

Thanks
Scott Wang



_______________________________________________
LDTP-dev mailing list
LDTP-dev@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev




--
Linux Desktop (GUI Application) Testing Project - http://ldtp.freedesktop.org
http://nagappanal.blogspot.com


_______________________________________________
LDTP-dev mailing list
LDTP-dev@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev

Re: The issue of CWD of scripts loaded by ldtprunner

by Ara Pulido :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 18/09/09 04:55, Nagappan Alagappan wrote:
Hi Scott,

 

2) The other is to use os.getcwd() and os.chcwd() to change the working directory. But it seems I can't use '__file__' macro to get the current executing file's path information resolved.

Is there a better solution or hack available?
Check Mago, we are using something similar: http://mago.ubuntu.com

Cheers,
Ara.



_______________________________________________
LDTP-dev mailing list
LDTP-dev@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev




--
Linux Desktop (GUI Application) Testing Project - http://ldtp.freedesktop.org
http://nagappanal.blogspot.com
_______________________________________________ LDTP-dev mailing list LDTP-dev@... http://lists.freedesktop.org/mailman/listinfo/ldtp-dev


_______________________________________________
LDTP-dev mailing list
LDTP-dev@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev

Re: The issue of CWD of scripts loaded by ldtprunner

by Wang Qi, Scott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, Ara,

Thanks for the information.

I am reading the mago release 0.1 to learn how it helps us :).

Best Regards
Scott Wang

On Fri, Sep 18, 2009 at 2:31 PM, Ara Pulido <ara@...> wrote:
On 18/09/09 04:55, Nagappan Alagappan wrote:
Hi Scott,


 

2) The other is to use os.getcwd() and os.chcwd() to change the working directory. But it seems I can't use '__file__' macro to get the current executing file's path information resolved.

Is there a better solution or hack available?
Check Mago, we are using something similar: http://mago.ubuntu.com

Cheers,
Ara.




_______________________________________________
LDTP-dev mailing list
LDTP-dev@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev




--
Linux Desktop (GUI Application) Testing Project - http://ldtp.freedesktop.org
http://nagappanal.blogspot.com
_______________________________________________ LDTP-dev mailing list LDTP-dev@... http://lists.freedesktop.org/mailman/listinfo/ldtp-dev



_______________________________________________
LDTP-dev mailing list
LDTP-dev@...
http://lists.freedesktop.org/mailman/listinfo/ldtp-dev