mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +00:00 
			
		
		
		
	target: Check that the connection works cleanly upon connection
Check that executing the most basic command works without troubles or stderr content. If that's not the case, raise a TargetStableError.
This commit is contained in:
		
				
					committed by
					
						
						Marc Bonnici
					
				
			
			
				
	
			
			
			
						parent
						
							62e24c5764
						
					
				
				
					commit
					7e682ed97d
				
			@@ -292,6 +292,7 @@ class Target(object):
 | 
				
			|||||||
        self.conn = self.get_connection(timeout=timeout)
 | 
					        self.conn = self.get_connection(timeout=timeout)
 | 
				
			||||||
        if check_boot_completed:
 | 
					        if check_boot_completed:
 | 
				
			||||||
            self.wait_boot_complete(timeout)
 | 
					            self.wait_boot_complete(timeout)
 | 
				
			||||||
 | 
					        self.check_connection()
 | 
				
			||||||
        self._resolve_paths()
 | 
					        self._resolve_paths()
 | 
				
			||||||
        self.execute('mkdir -p {}'.format(quote(self.working_directory)))
 | 
					        self.execute('mkdir -p {}'.format(quote(self.working_directory)))
 | 
				
			||||||
        self.execute('mkdir -p {}'.format(quote(self.executables_directory)))
 | 
					        self.execute('mkdir -p {}'.format(quote(self.executables_directory)))
 | 
				
			||||||
@@ -301,6 +302,14 @@ class Target(object):
 | 
				
			|||||||
        if self.platform.big_core and self.load_default_modules:
 | 
					        if self.platform.big_core and self.load_default_modules:
 | 
				
			||||||
            self._install_module(get_module('bl'))
 | 
					            self._install_module(get_module('bl'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def check_connection(self):
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Check that the connection works without obvious issues.
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        out = self.execute('true', as_root=False)
 | 
				
			||||||
 | 
					        if out.strip():
 | 
				
			||||||
 | 
					            raise TargetStableError('The shell seems to not be functional and adds content to stderr: {}'.format(out))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def disconnect(self):
 | 
					    def disconnect(self):
 | 
				
			||||||
        connections = self._conn.get_all_values()
 | 
					        connections = self._conn.get_all_values()
 | 
				
			||||||
        for conn in connections:
 | 
					        for conn in connections:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user