@@ -101,22 +101,39 @@ def run_and_check(command, cwd, file_stdout=None, file_stderr=None, testcase=Non
101
101
def wait_for_device (host : str , tries : int , seconds : int , log_path : str , testcase = None ) -> bool :
102
102
103
103
board_found = False
104
+ board_ssh_enabled = False
104
105
for i in range (tries ):
105
106
try :
106
107
print (f'Waiting for device { host } : try { i + 1 } of { tries } ' )
107
- time .sleep (seconds )
108
-
109
- run_and_check (
110
- ["ping" , "-c5" , host ],
111
- log_path , join (log_path , "ping.out" ), join (log_path , "ping.err" ), testcase )
112
108
113
- board_found = True
114
- break
109
+ if not board_found :
110
+ run_and_check (
111
+ ["ping" , "-c5" , host ],
112
+ log_path , join (log_path , "ping.out" ), join (log_path , "ping.err" ), testcase )
113
+
114
+ board_found = True
115
+ else :
116
+ run_and_check (
117
+ [ "ssh" ,
118
+ "-o" ,
119
+ "StrictHostKeyChecking no" ,
120
+ f"root@{ host } " ,
121
+ f"uname -a"
122
+ ],
123
+ log_path ,
124
+ join (log_path , "ssh_uname-a.out" ),
125
+ join (log_path , "ssh_uname-a.err" ),
126
+ testcase
127
+ )
128
+
129
+ board_ssh_enabled = True
130
+ break
115
131
except Exception as e :
116
132
print (str (e ))
133
+ time .sleep (seconds )
117
134
continue
118
135
119
- return board_found
136
+ return board_ssh_enabled
120
137
121
138
def setup_de10nano (hw_path : str , output_path : str , testcase = None ):
122
139
@@ -128,8 +145,6 @@ def setup_de10nano(hw_path: str, output_path: str, testcase=None):
128
145
try :
129
146
run_and_check (
130
147
[ "ssh" ,
131
- "-o" ,
132
- "StrictHostKeyChecking no" ,
133
148
f"root@{ host } " ,
134
149
f"mkdir -p ~/automated_testing; mkdir -p ~/boot; if grep -qs '/root/boot' /proc/mounts ;" \
135
150
+ "then echo 0 ; else mount /dev/mmcblk0p1 /root/boot ; fi"
0 commit comments