megoldas a loggerre, egyeb javitasok
[gp-arc-client-c.git] / ruby / test.rb
index e83dcf4..3ede909 100644 (file)
@@ -1,8 +1,10 @@
 require 'ffi'
 require 'pp'
 
+ENV["ARC_LOCATION"] = "/opt/local"
+
 jobdesc = File.read "/Users/tamas/quick/arc/arex/simple.jsdl"
-args = [""]#enelkul lemaradt a -c, az optionparser nyilvan levagja
+args = [""] #optparser cuts the first arg
 args += "-c ARC1:https://localhost:60000/arex -e".split
 args << jobdesc
 
@@ -29,10 +31,19 @@ argv.write_array_of_pointer(args.map {|arg| FFI::MemoryPointer.from_string(arg.t
 
 p "the version is: " + ArcClientCLibrary.initialize
 
-p "args:" + args.inspect
-result = ArcClientCLibrary.submit(args.size, argv)
 
-p (ArcClientCLibrary::SubmitResult.new(result))[:message].to_s
-p (ArcClientCLibrary::SubmitResult.new(result))[:job_id].to_s
+p "args:" + args.inspect
+2.times do |i|
+       p "running No. #{i}"
+       
+       argv = FFI::MemoryPointer.new(:pointer, args.size)
+       argv.write_array_of_pointer(args.map {|arg| FFI::MemoryPointer.from_string(arg.to_s)}) 
+       #you can not share argv between submit calls, i do not know why (it might be freed by optparser?)
+       
+       result = ArcClientCLibrary.submit(args.size, argv)
+       submitResult = ArcClientCLibrary::SubmitResult.new(result)
+       p (submitResult)[:message].to_s
+       p (submitResult)[:job_id].to_s
+end
 
 p "Done."
\ No newline at end of file