Invoking cts through batch - cts

I would like to run cts on windows using batch script. I want to run Android CTS 5.0 R3 version on windows 64 bit.
My script has the below command to invoke cts:
java -cp ddmlib-prebuilt.jar;tradefed-prebuilt.jar;hosttestlib.jar;cts-tradefed.jar -DCTS_ROOT=D:\cts com.android.cts.tradefed.command.CtsConsole
When I double click on my batch script, it will enter into a shell like "cts-tf>". I then have to manually run cts using " run cts --plan CTS " command.
I would like to put "run cts --plan CTS" command also as well as part of my batch script. i.e. when command prompt has entered into shell, I need to execute run cts --plan CTS from my batch file.

java -cp ddmlib-prebuilt.jar;tradefed-prebuilt.jar;hosttestlib.jar;cts-tradefed.jar -DCTS_ROOT=android-cts-6.0_r13-linux_x86-arm com.android.cts.tradefed.command.CtsConsole

Related

Run bash script in WSL through powershell script

I am trying to run a script which launches a WSL (ubuntu1804) terminal, and then run a bash script in that terminal
.\ubuntu1804.exe;
cd test_directory;
node server.js;
However after the first command the terminal open however, the two other commands aren't executed
.\ubuntu1804.exe by itself opens an interactive shell which PowerShell executes synchronously.
That is, until you submit exit in that interactive shell to terminate it, control won't be returned to PowerShell, so the subsequent commands - cd test_directory and note server.js - are not only not sent to .\ubuntu1804.exe, as you intended, but are then run by PowerShell.
Instead, you must pass the commands to run to .\ubuntu1804.exe via the run sub-command:
.\ubuntu1804.exe run 'cd test_directory; node server.js'
Note: Once node exits, control will be returned to PowerShell.

How to get session out put when we run cmd (running multiple exe files) remotely from Jenkins using powershell

How to get session output when we run cmd (running multiple exe files) remotely from Jenkins using powershell?
On Jenkins console, I can see whether the process is running or not using invoke command. But I can’t see exact output?!

Application's exit status is different than when application run by shell script

I have a confusion over the exit code of the application and the bash return value. For an eclipse application, a command line interface ran using eclipse returns the exit code as 1 (which is expected upon error). but when I run same command line using shell file and checks the return value with "echo $?" it always returns value as 0.
Application launched in command line mode in Eclipse :
Shell script :
command ="toolCli.exe -application arguments"
$command
echo $?
Output I get here is always 0, what's exactly the difference here?
$ com="echoo hi"
$ $com
No command 'echoo' found, did you mean:
Command 'echo' from package 'coreutils' (main)
echoo: command not found
$ echo $?
127
As you can see the exit value does work, I believe your issue might be to do with the environment, as in the eclipse environment be different from your bash environment?
From the java path, it looks like you have a 64 bit windows env and that eclipse might be using the standard windows command line, so I'm interested in how you are expecting it to behave as a bash env?
So maybe run the command under a windows command line and see if it fails, compare the java setup in both environments.

How to run a jar file from Jmeter?

I tried the following in the Bean Shell Sampler;
Runtime rt = Runtime.getRuntime();
rt.exec("cmd.exe /c && cd /Program Files/Java/jdk1.8.0_51/jre/bin & java -jar File-2.0-SNAPSHOT.WAR");
It looks like, it is not able to run.. Am i doing in the correct way?
If you need to do it with Beanshell, I would suggest the following amendment to the process command line:
cmd /c start java -jar .....
See cmd.exe documentation for more information
However in majority of cases it might be easier to use OS Process Sampler which allows executing arbitrary commands and programs. Check out How to Run External Commands and Programs Locally and Remotely from JMeter

Execute jar and display text in jenkins console log

I have abc.jar file to deploy and run in remote machine.
I have transferred the file using jenkins, now what I have done is, call a a.bat batch file on remote machine using psexec in Execute Windows Batch Command.
a.bat executes the abc.jar
When the jar begins execution, the command prompt texts are stored in a file.
using java -jar abc.jar >> a.log 2>&1
Now what I want is to display the a.log contents in the jenkins console when the jar file is being executed
(the file is continuously being written and I want to show it in jenkins console as it is being written)
I have tried to do it using parallel processing by calling start twice, one for calling batch file, another using type for displaying.
But when I use start I get Process leaked file descriptor .
Is there any other way I can achieve this. Be it calling powershell or scheduled task in jenkins.
You need to look for tee equivalents in windows , there are few like GNU utilities for Win32, however if you have cygwin you can still use tee which will easy the prcoess.
Now the wuestion arises how to run my jar file on cygwin from jenkins ?
you can still use execute windows[batch] shell. and add cygwin installation path to the PATH variable and start using linux command like a BOSS.
or you can use powershell tee in built command from batch.