UIAutomation disconnects with ADB wile running the test caese in Loop - android-uiautomator

I am getting problem of UiAutomation Not Connected, while running the UiAutomation test cases in loop.
AndroidRuntime: FATAL EXCEPTION: Timer-0 AndroidRuntime: Process:
com.android.imstressautomation, PID: 13697 AndroidRuntime:
java.lang.IllegalStateException: UiAutomation not connected!
AndroidRuntime:
android.app.UiAutomation.throwIfNotConnectedLocked(UiAutomation.java:971)
AndroidRuntime:
android.app.UiAutomation.waitForIdle(UiAutomation.java:577)
AndroidRuntime:android.support.test.uiautomator.UiAutomatorBridge.waitForIdle(UiAutomatorBridge.java:112)
AndroidRuntime:android.support.test.uiautomator.UiAutomatorBridge.waitForIdle(UiAutomatorBridge.java:107)
AndroidRuntime: at
android.support.test.uiautomator.QueryController.findAccessibilityNodeInfo(QueryController.java:143)
AndroidRuntime: at
android.support.test.uiautomator.QueryController.findAccessibilityNodeInfo(QueryController.java:138)
AndroidRuntime: at
android.support.test.uiautomator.UiObject.findAccessibilityNodeInfo(UiObject.java:188)
AndroidRuntime: at
android.support.test.uiautomator.UiObject.getChildCount(UiObject.java:1

Related

VHDL State machie is skipping state

I have written FSM on a FPGA, when I run simulation using iSim everything looks good, problem starts when I run my program on board(I'm using Spartan SP605 Eval Kit), and after looking up on signals using chipscope, I discovered that it skips state when the ADV signal should be low (see code below) and it just follows thru that state to the next one on witch it is stuck.
I've check and I do not violate any of my timing requirement.
A little bit of my project:
I'm using Cypres board to receive and sent data to/from PC,hardware there works as it should be. This board is connected to FPGA via FMC interconnection board (also from Cypress). This board contains two buffers (FIFO; one for transfer to FPGA and one to transfer from FPGA), FPGA sees flags that indicates state of those buffers (flag A - full, B - partial full, C - empty, D - partial empty). FPGA is configured as loopback, it first reads all data from board, then transfer those data to it.
flags are active low.
I tried to force it to run without those if's (every clock cycle is new state), and it worked as expected (I got error from board that says it tries to read from empty buffer)
here is fragment of my State machie code, the state it skips is named ADDRRead.
If you are intrested in full code I posted it on pastebin https://pastebin.pl/view/ae9b57ce
process(currentFPGAMode, writeEnable, chipEnable, outputEnable, rdy, flagA, flagb, flagD, flagC, readEmptyDelayCnt, writeFullDelayCnt)
begin
case currentFPGAMode is
when Idle =>
if (flagc = '1') --check if buffer is avaible
then
nextFPGAMode <= waitFlagD;
else
nextFPGAMode <= Idle;
end if;
when waitFlagD =>
--wait for data to appear in buffer (from PC)
if (flagD = '1')
then
nextFPGAMode <= ADDRRead;
else
nextFPGAMode <= waitFlagD;
end if;
when ADDRRead =>
--setting up address bus to point on endpoint for read transfer
nextFPGAMode <= OeDelay;
when OeDelay =>
--waiting for valid data
if (rdy = '1')
then
nextFPGAMode <= FPGARead;
else
nextFPGAMode <= OeDelay;
end if;
when FPGARead =>
--valid data data are avaible here
if (flagD = '1') --check if there are data to be read
then
nextFPGAMode <= FPGARead;
else
nextFPGAMode <= ReadEndDelay;
end if;
when ReadEndDelay =>
if (readEmptyDelayCnt = 0)
then
nextFPGAMode <= FPGAReadEnd;
else
nextFPGAMode <= ReadEndDelay;
end if;
when FPGAReadEnd =>
--end read sequence
nextFPGAMode <= waitFlagA;
when waitFlagA =>
--checking if DMA Buffer is empty
if (flagA = '1')
then
nextFPGAMode <= ADDRWrite;
else
nextFPGAMode <= waitFlaga;
end if;
when ADDRWrite =>
--seting address bus to point at endpoint for writetransfer (address line = 3)
nextFPGAMode <= WeDelay;
when WeDelay =>
--waiting for valid data to apear
if (rdy = '1')
then
nextFPGAMode <= FPGAWrite;
else
nextFPGAMode <= WeDelay;
end if;
when FPGAWrite =>
--data are avaible to apear
if ( flagb = '0')
then
nextFPGAMode <= WriteEndDelay;
else
nextFPGAMode <= FPGAWrite;
end if;
when WriteEndDelay =>
if (writeFullDelayCnt = 0)
then
nextFPGAMode <= RDYDelay;
else
nextFPGAMode <= WriteEndDelay;
end if;
when RDYDelay =>
--Delay for rdy signal to deassert after finishing transfer
if (rdy = '0')
then
nextFPGAMode <= Idle;
else
nextFPGAMode <= RDYDelay;
end if;
when others =>
nextFPGAMode <= Idle;
end case;
end process;

VHDL program doesn't set output

This is my VHDL code:
entity Operation is
port (
clk16: in std_logic; // 16 MHz input clock
start_cmd: inout std_logic; // open drain line. When CPLD sees it is pulled low, it keeps pulling it low till the operation is finished
clk_out: buffer std_logic; // output clock derived from clk16
);
end Operation;
architecture a of Operation is
type T_STATE is (STOPPED, STARTING, ....another states....);
signal state: T_STATE := STOPPED;
begin
process (clk16, clk_out)
begin
if rising_edge(clk16) then
clk_out <= not clk_out; -- create clk_out clock
end if;
if rising_edge(clk_out) then
case state is
when STOPPED =>
if start_cmd = '0' then
state <= STARTING;
start_cmd <= '0' -- sometimes this doesn't happen
end if;
when STARTING =>
-- code continues here.... after the operation is finished, start_cmd <= 'Z' is "executed"
I have start_cmd signal connected to my CPLD. It is open drain signal with pull up that is connected also to another device. When another device wants CPLD to start some operation, it pulls start_cmd to low. When CPLD sees start_cmd is low it also pulls the line low. After a while another device releases the line. When the operation by CPLD is finished, CPLD releases the line. As nobody is now pulling the line low, the line goes high. Another device then knows that CPLD's operation finished.
The problem is that sometimes (10 %) start_cmd <= '0' is not "executed" so start_cmd signal returns high once another device stops pulling start_cmd low. Another device then detects false "operation finished".
Can you see any problem why start_cmd <= '0' is not "executed" sometimes?
I debugged my device using oscilloscope and I can see that this situation happens when another device pulls start_cmd to low exactly at rising edge of clk_out.
This VHDL is implemented on MAX V CPLD using Quartus Prime.
First - I think you should always initialize the inout with 'Z' at start up
Add a new state INIT to T_STATE
type T_STATE is (INIT,STOPPED, STARTING, ....another states....);
and initialise state to INIT
signal state: T_STATE := INIT;
case state is
when INIT =>
start_cmd <= 'Z';
state <= STOPPED;
when STOPPED =>
:
Second I'm not sure about the requirement of the clk_out buffer . I don't think it is needed unless there is a specific reason. It seems like all you need is
if falling_edge(clk16) then
case state is
:

Verilog equivalent of "wait until ... for ..."?

In a Verilog testbench, I'm trying to code the following behavior:
Wait until an event occurs (rising / falling edge) for a maximum time, i.e. an equivalent of the VHDL instruction:
wait until <event> for <duration>;
which has the following behavior (reminder):
either the event occurs;
or the duration expires.
Unless I'm mistaken, I did not find any direct equivalent of this function in Verilog... So I tried the following code:
reg watchdog;
// ...
// Set a signal 'watchdog' in background which will be triggered in 10 us.
fork
watchdog <= #10_000 1'b1;
join
// Wait until SIGNAL is set to '1' *OR* watchdog event occurs.
#(posedge SIGNAL or posedge watchdog);
// Reset the watchdog
watchdog <= 1'b0;
This code does the work but the last instruction does not cancel or supercede the fork instruction. So, in a second call to this code (with for example watchdog <= #50_000 1'b1;), the first watchdog may be triggered (too soon unfortunately).
Any better idea? (either an equivalent or a way to cancel the first planned fork?)
P-S : to do it in SystemVerilog is not an option... ;-)
To do this in Verilog you need to use disable. I would suggest getting rid of the watchdog signal entirely and just using two branches of a fork.
Below is a working example. Note that each branch of the fork calls disable f if that branch succeeds. Disabling the fork will terminate the branch which did not succeed.
module top;
reg signal;
task test();
fork : f
begin
// Timeout check
#10
$display("%t : timeout", $time);
disable f;
end
begin
// Wait on signal
#(posedge signal);
$display("%t : posedge signal", $time);
disable f;
end
join
endtask
initial begin
// test signal before timeout
fork
test;
begin
signal = 0;
#5;
signal = 1;
#5;
signal = 0;
#10;
end
join
// test signal after timeout
fork
test;
begin
signal = 0;
#15;
signal = 1;
#5;
end
join
end
Your fork join only has one process, so you are not doing anything in parallel.
This should do what you want:
fork : wait_or_timeout
begin
#10_000; //#10ms
disable wait_or_timeout;
end
begin
#(posedge SIGNAL);
disable wait_or_timeout;
end
join

Ruby ssh error Net::SSH::AuthenticationFailed while it works with PHP

I try to connect a server though SSH using Ruby, but I have an Net::SSH::AuthenticationFailed error. The problem is that it works in PHP.
Here's my ruby code:
require 'rubygems'
require 'net/ssh'
include Net
domain = 'ks2.so.d-sites.com' # insert IP address or domain name here
begin
Net::SSH.start( domain, 'webistrano', :verbose => :debug, :keys => ['/home/webistrano/.ssh/id_rsa', '/home/webistrano/.ssh/id_rsa.pub'], :port => 22 ) do |ssh|
print "connected"
end
rescue Net::SSH::HostKeyMismatch => e
puts "remembering new key: #{e.fingerprint}"
e.remember_host!
retry
end
And I get this errors:
D, [2012-03-06T20:40:02.974862 #24165] DEBUG -- net.ssh.transport.session[3f8c5d3a06a0]: establishing connection to ks2.so.d-sites.com:22
D, [2012-03-06T20:40:02.975912 #24165] DEBUG -- net.ssh.transport.session[3f8c5d3a06a0]: connection established
I, [2012-03-06T20:40:02.976039 #24165] INFO -- net.ssh.transport.server_version[3f8c5d39edc8]: negotiating protocol version
D, [2012-03-06T20:40:02.981160 #24165] DEBUG -- net.ssh.transport.server_version[3f8c5d39edc8]: remote is `SSH-2.0-OpenSSH_5.8p1-hpn13v10'
D, [2012-03-06T20:40:02.981231 #24165] DEBUG -- net.ssh.transport.server_version[3f8c5d39edc8]: local is `SSH-2.0-Ruby/Net::SSH_2.3.0 x86_64-linux'
D, [2012-03-06T20:40:02.982272 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: read 856 bytes
D, [2012-03-06T20:40:02.982418 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: received packet nr 0 type 20 len 852
I, [2012-03-06T20:40:02.982517 #24165] INFO -- net.ssh.transport.algorithms[3f8c5d39e418]: got KEXINIT from server
I, [2012-03-06T20:40:02.982690 #24165] INFO -- net.ssh.transport.algorithms[3f8c5d39e418]: sending KEXINIT
D, [2012-03-06T20:40:02.982883 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: queueing packet nr 0 type 20 len 716
D, [2012-03-06T20:40:02.982960 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: sent 720 bytes
I, [2012-03-06T20:40:02.983003 #24165] INFO -- net.ssh.transport.algorithms[3f8c5d39e418]: negotiating algorithms
D, [2012-03-06T20:40:02.983161 #24165] DEBUG -- net.ssh.transport.algorithms[3f8c5d39e418]: negotiated:
* kex: diffie-hellman-group-exchange-sha1
* host_key: ssh-rsa
* encryption_server: aes128-cbc
* encryption_client: aes128-cbc
* hmac_client: hmac-sha1
* hmac_server: hmac-sha1
* compression_client: none
* compression_server: none
* language_client:
* language_server:
D, [2012-03-06T20:40:02.983207 #24165] DEBUG -- net.ssh.transport.algorithms[3f8c5d39e418]: exchanging keys
D, [2012-03-06T20:40:02.983416 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: queueing packet nr 1 type 34 len 20
D, [2012-03-06T20:40:02.983469 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: sent 24 bytes
D, [2012-03-06T20:40:03.024146 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: read 152 bytes
D, [2012-03-06T20:40:03.024270 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: received packet nr 1 type 31 len 148
D, [2012-03-06T20:40:03.027331 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: queueing packet nr 2 type 32 len 140
D, [2012-03-06T20:40:03.027409 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: sent 144 bytes
D, [2012-03-06T20:40:03.032446 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: read 720 bytes
D, [2012-03-06T20:40:03.032563 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: received packet nr 2 type 33 len 700
D, [2012-03-06T20:40:03.035433 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: queueing packet nr 3 type 21 len 20
D, [2012-03-06T20:40:03.035505 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: sent 24 bytes
D, [2012-03-06T20:40:03.035617 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: received packet nr 3 type 21 len 12
D, [2012-03-06T20:40:03.035954 #24165] DEBUG -- net.ssh.authentication.session[3f8c5e189fdc]: beginning authentication of `webistrano'
D, [2012-03-06T20:40:03.036081 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: queueing packet nr 4 type 5 len 28
D, [2012-03-06T20:40:03.036130 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: sent 52 bytes
D, [2012-03-06T20:40:03.074777 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: read 52 bytes
D, [2012-03-06T20:40:03.074912 #24165] DEBUG -- tcpsocket[3f8c5d39f250]: received packet nr 4 type 6 len 28
D, [2012-03-06T20:40:03.075018 #24165] DEBUG -- net.ssh.authentication.session[3f8c5e189fdc]: trying password
E, [2012-03-06T20:40:03.075077 #24165] ERROR -- net.ssh.authentication.session[3f8c5e189fdc]: all authorization methods failed (tried password)
/usr/lib64/ruby/gems/1.8/gems/net-ssh-2.3.0/lib/net/ssh.rb:200:in `start': webistrano (Net::SSH::AuthenticationFailed)
from ssh-test.rb:6
I wrote a simple PHP code, and it works:
<?php
$connection = ssh2_connect('ks2.so.d-sites.com', 22);
if (ssh2_auth_pubkey_file($connection, 'webistrano',
'/home/webistrano/.ssh/id_rsa.pub',
'/home/webistrano/.ssh/id_rsa')) {
echo "Identification réussie en utilisant une clé publique\n";
} else {
die('Echec de l\'identification en utilisant une clé publique');
}
Is there someone that can help me?
Thanks a lot in advance!
I've found how to solve that problem: adding a :auth_methods => ['publickey','password'] parameter in the Net::SSH.start function.
I have seen that error before,try uninstalling the gem 'net-ssh',try this:gem uninstall net-ssh -v 2.8.0, it works for me,
refer to: https://stackoverflow.com/a/21566548/3159604
I didn't use the Net::SSH.start solution but opted to set :ssh_options, {:forward_agent => true, :auth_methods => 'publickey'} which seems to work on my end.
Noted that Initially, I just used set :ssh_options, {:forward_agent => true} on 3 machines running on FreeBSD, CentOS and MacOSX and it worked fine - even used on production releases, however after testing on a VBoxed Vagrant-based CentOS (6.4) machine it stopped working. So, adding auth_method did the trick.
Just running ssh-add (in the terminal) and trying again (to deploy) worked for me.

Ruby behaves differently in windows task scheduler

Ruby won't recognize directories when run from the task scheduler. I've had similar issues with ruby when running from the windows task scheduler.
Can anyone explain why ruby behaves this way when run from the Windows Task Scheduler?
Consider the following directory on my desktop
(d)test
----(d)One
----(d)Two
----(d)Three
----(f)dirs.rb
----(f)log.log
(d) = Directory
(f) = file
Consider the following Ruby script.
require 'logger'
log = Logger.new("C:/Users/crosson.Z7NETWORKS/Desktop/test/log.log", 'daily')
log.level = Logger::INFO
Dir.new("C:/Users/crosson.Z7NETWORKS/Desktop/test").each do |file|
log.info "%7s a dir? %s" % [file, File.directory?(file)]
end
Below is a result of the log when run from the command line.
I, [2011-08-30T12:50:47.700617 #5356] INFO -- : . a dir? true
I, [2011-08-30T12:50:47.700617 #5356] INFO -- : .. a dir? true
I, [2011-08-30T12:50:47.700617 #5356] INFO -- : dirs.rb a dir? false
I, [2011-08-30T12:50:47.700617 #5356] INFO -- : log.log a dir? false
I, [2011-08-30T12:50:47.700617 #5356] INFO -- : One a dir? true
I, [2011-08-30T12:50:47.700617 #5356] INFO -- : Three a dir? true
I, [2011-08-30T12:50:47.701617 #5356] INFO -- : Two a dir? true
Below is a result of the log when run from the task scheduler
I, [2011-08-30T13:03:07.187316 #5972] INFO -- : . a dir? true
I, [2011-08-30T13:03:07.188316 #5972] INFO -- : .. a dir? true
I, [2011-08-30T13:03:07.188316 #5972] INFO -- : dirs.rb a dir? false
I, [2011-08-30T13:03:07.188316 #5972] INFO -- : log.log a dir? false
I, [2011-08-30T13:03:07.188316 #5972] INFO -- : One a dir? false
I, [2011-08-30T13:03:07.188316 #5972] INFO -- : Three a dir? false
I, [2011-08-30T13:03:07.188316 #5972] INFO -- : Two a dir? false
Notice that my directories, One, Two and Three are no longer considered directories. What gives?
This is a complete guess, but what user is the Windows Task Scheduler using to run the script? I dimly remember issues with the task scheduler due to that process not having the same constellation of rights as me.

Resources