I'm executing the command wmic process where Description="java.exe" get caption through my tcl shell and getting below error:-
Node - HAW-TEST-04
ERROR:
Description = Invalid query
while the same commands runs perfectly from command terminal
`C:\>wmic process where Description="java.exe" get caption`
Caption
java.exe
java.exe
java.exe
java.exe
% exec wmic process where Description='java.exe' get caption
Caption
java.exe
%
Related
Recently, I tried to debug a cross compiled arm program with QEMU, but I got stuck with an issue.
This is the code, very simple.
int main()
{
printf("aaa\n");
int status;
status = system("./bin/ls");
printf("Result of [system] = 0x%x\n", status);
}
When I launch the program using command
spy#spy-virtual-machine:/usr/arm-linux-gnueabihf$ ./qemu-arm-static -L ./ ./a.out
The output is:
aaa
bin include lib test.c qemu-arm-static a.out qemu-arm shell.sh
Result of [system] = 0x0
But when I launch the program with chroot like this:
spy#spy-virtual-machine:/usr/arm-linux-gnueabihf$ sudo chroot ./ ./qemu-arm-static -L ./ ./a.out
The output turns out to be:
aaa
Result of [system] = 0x7f00
Apparently the system("./bin/ls") is not run as expected.
But the ./bin/ls command can be run by chroot & QEMU:
spy#spy-virtual-machine:/usr/arm-linux-gnueabihf$ sudo chroot ./ ./qemu-arm-static -L ./ ./bin/ls
bin include lib test.c qemu-arm-static a.out qemu-arm shell.sh
Now I'm totally confused. Can anybody give me a hint on this, and what can I do to get the right output of system function when using chroot command.
All command line input and output can be found in this picture:
Command line content
From man 3 system:
system() executes a command specified in command by calling /bin/sh -c
command
So you need a working shell inside the chroot in order to be able to successfully invoke system().
The following happens when this program runs in qemu-arm-static: system() results in fork() followed by exec() for the shell. When you run it without chroot this is your host (x86) shell. The shell then calls fork() followed by exec() for the bin/ls (ARM). My understanding is that it can only succeed if you have binfmt handler for the ARM ELF registered on your host. In that case registered qemu-arm gets loaded and it executes bin/ls.
When you do the same thing in the chroot the host shell is not accessible, so system() results in exec() call for the bin/sh (ARM). It looks like your binfmt handler is not accessible inside the chroot, and because of that loading bin/sh fails and error status is returned from system().
You can check registered binfmt handlers in the /proc/sys/fs/binfmt_misc
I have the following tcl script:
vsim -voptargs="+acc" +UVM_TESTNAME=axi_test +RANDOM_TYPE=$1 +FIXED_DLY=$2 +PATH=$3 test_tb_top +UVM_MAX_QUIT_COUNT=1
log -r test_tb_top/*
do do/default_axi_wave.do
I called this script from the command line by:
vsim -c -do test_sim.tcl random 0 params
I got the following error
Error: (vsim-3170) Could not find 'C:/ver/work.random'.
I am trying to make automation in API testing.
For that I used newman.
It is working in my shell.
But when I am trying to put it in jenkins. It doesn't work.
I am using below command for run the my test case in jenkins
newman -c /home/soham/Desktop/api.json --insecure
Jenkins gives below error:
Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/api_automation/workspace
[workspace] $ /bin/sh -xe /tmp/hudson4223675241512864410.sh
+ newman -c /home/soham/Desktop/api.json --insecure
[31mThe collection file /home/soham/Desktop/api.json could not be parsed.
[39mBuild step 'Execute shell' marked build as failure
Finished: FAILURE
How can I solve this problem?
I know I can put commands in my source code in .ebextensions/*.config using the commands array. These are executed on every deploy however. What about if I want to execute a configuration command only once when spinning up a new instance?
Commands can be run conditionally using the test: modifier. You specify a test to be done. If the test returns 0, the command is run, otherwise it is not.
If the last command in your config file touches a file, and the commands above that you only want to run once check for the existence of that file, then those commands will only run the first time.
commands:
01-do-always:
command: run_my_script
02-do-on-boot:
command: script_to_run_once
test: test ! -f .semaphore
99-signal-startup-complete:
command: touch .semaphore
On Windows it would be something like this
commands:
01-do-always:
command: run_my_script
02-do-on-boot:
command: script_to_run_once
test: if exists c:\\path\\to\\semaphore.txt (exit 0) else (exit 1)
99-signal-startup-complete:
command: date > c:\\path\\to\\semaphore.txt
On Windows this should work:
commands:
01-do-always:
command: run_my_script
02-do-on-boot:
command: script_to_run_once
test: cmd /c "if exist c:\\semaphore.txt (exit 1) else (exit 0)"
99-signal-startup-complete:
command: echo %date% %time% > c:\\semaphore.txt
Note that I had to change the test command from Jim Flanagan's answer.
I am running this code in tcl:-
set version [exec grep "INTERNAL VERSION:" mojave.log | sed -n -e "s/INTERNAL VERSION: //g" > xor.diff]
set p [exec diff ../log.warning.diff ../log.warning.gold >> xor.diff ]
For the last line it gives the following error after doing some diff:-
> RULE-311 WARNING: Gdsii layer number 85 datatype 0 has already been defined
> TCL-11 WARNING: Command "check quartz drc" is overridden, Quality Of
> TCL-11 WARNING: Command "delete marker quartz" is overridden, Quality Of
> TCL-11 WARNING: Command "import marker quartz" is overridden, Quality Of
> TCL-11 WARNING: Command "mojave! run filter log" is overridden, Quality Of
> TCL-11 WARNING: Command "run quartz gui" is overridden, Quality Of Results
> TCL-11 WARNING: Command "ui! mojave draw rectangle" is overridden, Quality
> TCL-11 WARNING: Command "ui! mojave set_context" is overridden, Quality Of
> TCL-12 WARNING: Overridden command "mojave! run filter log" is used,
child process exited abnormally
while executing
"exec diff ../log.warning.diff ../log.warning.gold 2> xor.diff "
invoked from within
"set p [exec diff ../log.warning.diff ../log.warning.gold 2> xor.diff ]"
(file "test.tcl" line 4)
invoked from within
"source test.tcl"
And it is not writing anything in "xor.diff" file.
exec returns an error if the command returns non-zero or if it sends anything to stderr. There's a very thorough discussion of using catch with exec at http://wiki.tcl.tk/exec
diff (and comm) exits nonzero if any differences are found, so you can redirect the output to use them as "did this change?" tests. For Tcl you'll want to use the `|| :' idiom to ignore the exit status.
P.S. "useless use of grep"... sed -n -e '/INTERNAL VERSION: /s//gp'