[gvfs] gvfs-test: Stop using /var/log/sshd.log



commit ee7f7ebab9b1698d92fe27a85e4b85ef4a49250a
Author: Martin Pitt <martinpitt gnome org>
Date:   Mon Oct 15 11:31:24 2012 +0200

    gvfs-test: Stop using /var/log/sshd.log
    
    Just read sshd's output directly from the process' stderr pipe. With that we
    can stop relying on that part of gvfs-testbed and get the tests closer to being
    able to run without gvfs-testbed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686006

 test/gvfs-test |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/test/gvfs-test b/test/gvfs-test
index a5b3db4..991d1ab 100755
--- a/test/gvfs-test
+++ b/test/gvfs-test
@@ -276,9 +276,9 @@ Subsystem sftp %(sftp_server)s
        'sftp_server': sftp_server
       })
 
-        self.sshd_log = open('/var/log/sshd.log', 'ab')
         self.sshd = subprocess.Popen([os.environ['SSHD'], '-Dde', '-f', self.sshd_config],
-                                     stderr=self.sshd_log)
+                                     universal_newlines=True,
+                                     stderr=subprocess.PIPE)
 
     def tearDown(self):
         if os.path.exists('.ssh/authorized_keys'):
@@ -287,9 +287,17 @@ Subsystem sftp %(sftp_server)s
         if self.sshd.returncode is None:
             self.sshd.terminate()
             self.sshd.wait()
-        self.sshd_log.close()
         super().tearDown()
 
+    def run(self, result=None):
+        '''Show sshd log output on failed tests'''
+
+        if result:
+            orig_err_fail = result.errors + result.failures
+        super().run(result)
+        if result and result.errors + result.failures > orig_err_fail:
+            print('\n----- sshd log -----\n%s\n------\n' % self.sshd.stderr.read())
+
     def test_rsa(self):
         '''sftp://localhost with RSA authentication'''
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]