[PATCH] rt-app: add a dry run option for workgen

2014-11-04 Thread Vincent Guittot
The dry run option "-d" only generates a output json file and doesn't call
rt-app. The output file can be then used with rt-app

Typical use should be:
workgen -d -o  

Signed-off-by: Vincent Guittot 
---
 doc/workgen | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/doc/workgen b/doc/workgen
index 4951086..9a0d7cd 100755
--- a/doc/workgen
+++ b/doc/workgen
@@ -150,9 +150,10 @@ if __name__ == '__main__':
 outfile = "unikid.json"
 selfupdate = 0
 verbose = 0
+dry_run = False
 
 try:
-opts, args = getopt.getopt(sys.argv[1:], "o:av")
+opts, args = getopt.getopt(sys.argv[1:], "o:avd")
 except getopt.GetoptError as err:
 print str(err) # will print something like "option -a not recognized"
 sys.exit(2)
@@ -164,15 +165,18 @@ if __name__ == '__main__':
 selfupate = 1
 if o == "-v":
 verbose = 1
+if o == "-d":
+dry_run = True
 
+for f in args:
 if selfupdate:
 outfile = f
 
-for f in args:
 check_suspend_json(f, outfile)
 check_unikid_json(outfile, outfile)
 
-subprocess.call(["rt-app", outfile])
+if not dry_run:
+subprocess.call(["rt-app", outfile])
 
 
 
-- 
1.9.1


___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev


Re: [PATCH] rt-app: add a dry run option for workgen

2014-11-04 Thread Ivan T. Ivanov

On Tue, 2014-11-04 at 13:52 +0100, Vincent Guittot wrote:
> The dry run option "-d" only generates a output json file and doesn't call
> rt-app. The output file can be then used with rt-app
> 
> Typical use should be:
> workgen -d -o  
> 

Thank you Vincent. It looks ok to me, based on my very limited Phyton skills. 

Regards,
Ivan

> Signed-off-by: Vincent Guittot 
> ---
>  doc/workgen | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/doc/workgen b/doc/workgen
> index 4951086..9a0d7cd 100755
> --- a/doc/workgen
> +++ b/doc/workgen
> @@ -150,9 +150,10 @@ if __name__ == '__main__':
>  outfile = "unikid.json"
>  selfupdate = 0
>  verbose = 0
> +dry_run = False
> 
>  try:
> -opts, args = getopt.getopt(sys.argv[1:], "o:av")
> +opts, args = getopt.getopt(sys.argv[1:], "o:avd")
>  except getopt.GetoptError as err:
>  print str(err) # will print something like "option -a not recognized"
>  sys.exit(2)
> @@ -164,15 +165,18 @@ if __name__ == '__main__':
>  selfupate = 1
>  if o == "-v":
>  verbose = 1
> +if o == "-d":
> +dry_run = True
> 
> +for f in args:
>  if selfupdate:
>  outfile = f
> 
> -for f in args:
>  check_suspend_json(f, outfile)
>  check_unikid_json(outfile, outfile)
> 
> -subprocess.call(["rt-app", outfile])
> +if not dry_run:
> +subprocess.call(["rt-app", outfile])
> 
> 
> 
> 

___
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev