示例#1
0
文件: modem.py 项目: mcruse/monotone
    def _runtest(self):
        message('Executing modem tests:')

        if not os.access('/tmp/test.fil', os.F_OK):
            os.system('dd if=/dev/zero of=/tmp/test.file bs=64k count=1 1>/dev/null 2>/dev/null')

        msg_testing('  Starting PPP...')
        os.system('/etc/ppp/ppp-on')

        ####
        # We don't get any feedback from pppd or chat regarding success or
        # failure of bringing up a PPP interface (ppp0 in our case).  So, wait
        # for 45 seconds and see if ppp0 exists.
        time.sleep(45)
        result, spewage = execute_command('ifconfig ppp0')
        if not result:
            msg_fail()
            self._nerrors += 1
            self._logger.log('ERROR: ppp did not start: %s\n' % spewage)
            return 0
        message('done.')

        msg_testing('  Sending file...',)
        result, spewage = execute_command('scp /tmp/test.file [email protected]:/tmp/.')
        # MAGIC NUMBER ALERT!!!....................................^^^^^^^^^^^^^
        if not result:
            msg_fail()
            self._nerrors += 1
            self._logger.log('ERROR: scp to host failed: %s\n' % spewage)
            return 0
        message('done.')

        msg_testing('  Retrieving file...')
        result, spewage = execute_command('scp [email protected]:/tmp/test.file .')
        # MAGIC NUMBER ALERT!!!.....................^^^^^^^^^^^^^
        os.unlink('./test.file')
        if not result:
            msg_fail()
            self._nerrors += 1
            self._logger.log('ERROR: scp from host failed: %s\n' % spewage)
            return 0
        message('done.')

        msg_testing('  Deleting file on remote system...')
        result, spewage = execute_command('ssh [email protected] rm -f /tmp/test.file')
        # MAGIC NUMBER ALERT!!!.....................^^^^^^^^^^^^^
        if not result:
            msg_fail()
            self._nerrors += 1
            self._logger.log('ERROR: ssh on host failed: %s\n' % spewage)
            return 0
        message('done.')

        msg_testing('  Stopping PPP...')
        os.system('/etc/ppp/ppp-off 1>/dev/null 2>/dev/null')
        message('done.')

        return 1
示例#2
0
文件: i2c.py 项目: mcruse/monotone
 def set_hwclock(self, unix_time):
     unix_time = float(unix_time)
     time_tuple = time.localtime(unix_time)
     cmd = 'date -s "%s"' % (time.strftime('%m/%d/%Y %H:%M:%S', time_tuple))
     self.log('RTC: Running command - %s' % cmd)
     result, spewage = execute_command(cmd)
     if not result:
         self.log('ERROR: Could not set RTC time: %s' % spewage)
         return False
     result, spewage = execute_command('hwclock -wu')
     if not result:
         self.log('ERROR: Could not execute hwclock: %s' % spewage)
         return False
     return True
示例#3
0
 def set_hwclock(self, unix_time):
     unix_time = float(unix_time)
     time_tuple = time.localtime(unix_time)
     cmd = 'date -s "%s"' % (time.strftime('%m/%d/%Y %H:%M:%S', time_tuple))
     self.log('RTC: Running command - %s' % cmd)
     result, spewage = execute_command(cmd)
     if not result:
         self.log('ERROR: Could not set RTC time: %s' % spewage)
         return False
     result, spewage = execute_command('hwclock -wu')
     if not result:
         self.log('ERROR: Could not execute hwclock: %s' % spewage)
         return False
     return True
示例#4
0
    def print_prerun_summary(self):
        if self._enabled_tests <= 1:
            return
        self._logger.msg('Mediator hardware test program revision %s.\n',
                         hwtest_version())
        self._logger.msg(
            'Copyright (C) 2009 Cisco Systems, Inc.  All rights reserved.\n\n')
        self._logger.msg('Test executed on %s\n' % os.popen('date').readline())
        self._logger.msg('Model number: %s\n' % self._hw_info.model())
        self._logger.msg('Framework version: %s\n' %
                         properties.COMPOUND_VERSION)
        self._logger.msg('MOE version: %s\n' % properties.MOE_VERSION)
        self._logger.msg('Serial number: %s\n' % self._hw_info.serialno())
        self._logger.msg('eth0 MAC address: %s\n' % self._hw_info.mac_addr(0))
        if self._hw_info.model() in ('TSWS', '2400', '2500'):
            self._logger.msg('eth1 MAC address: %s\n' %
                             self._hw_info.mac_addr(1))

        ###
        # Having a list of loaded modules will be extremely helpful in the
        # event a test should fail (because the module might not have loaded).
        self._logger.msg('Loaded kernel modules:\n')
        result, spewage = execute_command('/sbin/lsmod')
        if not result:
            raise Exception('Cannot get module info, aborting test.')

        for line in spewage:
            self._logger.msg(line)

        self._logger.msg('\n')
        return
示例#5
0
    def print_prerun_summary(self):
        if self._enabled_tests <= 1:
            return
        self._logger.msg('Mediator hardware test program revision %s.\n', hwtest_version())
        self._logger.msg('Copyright (C) 2009 Cisco Systems, Inc.  All rights reserved.\n\n')
        self._logger.msg('Test executed on %s\n' % os.popen('date').readline())
        self._logger.msg('Model number: %s\n' % self._hw_info.model())
        self._logger.msg('Framework version: %s\n' % properties.COMPOUND_VERSION)
        self._logger.msg('MOE version: %s\n' % properties.MOE_VERSION)
        self._logger.msg('Serial number: %s\n' % self._hw_info.serialno())
        self._logger.msg('eth0 MAC address: %s\n' % self._hw_info.mac_addr(0))
        if self._hw_info.model() in ('TSWS', '2400', '2500'):
           self._logger.msg('eth1 MAC address: %s\n' % self._hw_info.mac_addr(1))

        ###
        # Having a list of loaded modules will be extremely helpful in the
        # event a test should fail (because the module might not have loaded).
        self._logger.msg('Loaded kernel modules:\n')
        result, spewage = execute_command('/sbin/lsmod')
        if not result:
           raise Exception('Cannot get module info, aborting test.')

        for line in spewage:
            self._logger.msg(line)

        self._logger.msg('\n')
        return
示例#6
0
    def load_eeprom_text(self):
        rslt, text = execute_command("ns -p0 -b -T")
        text = text[0]
        if not rslt:
            raise Exception('Unable to load eeprom text')
        if text.find(';') >= 0:
            self._product_id, self._assembly = text.split(';')
            self._assembly = self._assembly.strip()

        rslt, text = execute_command("ns -p1 -b -T")
        text = text[0]
        if not rslt:
            raise Exception('Unable to load eeprom text')
        if text.find(';') >= 0:
            self._serialno_df, self._serialno_cisco = text.split(';')
            self._serialno_cisco = self._serialno_cisco.strip()
        return
示例#7
0
 def is_dead(self):
     result, spewage = execute_command('/usr/bin/i2cdump 0 0x68')
     if not result:
         return 1
     result = self.dead_chip_re.match(spewage[4])
     if result:
         return 1
     return 0
示例#8
0
    def load_eeprom_text(self):
        rslt, text = execute_command("ns -p0 -b -T")
        text = text[0]
        if not rslt:
            raise Exception("Unable to load eeprom text")
        if text.find(";") >= 0:
            self._product_id, self._assembly = text.split(";")
            self._assembly = self._assembly.strip()

        rslt, text = execute_command("ns -p1 -b -T")
        text = text[0]
        if not rslt:
            raise Exception("Unable to load eeprom text")
        if text.find(";") >= 0:
            self._serialno_df, self._serialno_cisco = text.split(";")
            self._serialno_cisco = self._serialno_cisco.strip()
        return
示例#9
0
文件: i2c.py 项目: mcruse/monotone
 def is_dead(self):
     result, spewage = execute_command('/usr/bin/i2cdump 0 0x68')
     if not result:
         return 1
     result = self.dead_chip_re.match(spewage[4])
     if result:
         return 1
     return 0
示例#10
0
文件: memory.py 项目: mcruse/monotone
 def runtest(self):
     self.log('Testing system RAM.')
     result, spewage = execute_command(self.testprog)
     if not result:
         self.log('ERROR: Memory test failed: %s' % spewage)
         self._nerrors += 1
     else:
         self.log('SUCCESS: Memory test passed: %s' % spewage)
     return self.passed()
示例#11
0
    def __init__(self, config, hw_info, logger):
        TestMethods.__init__(self, 'I2C RAM', config, hw_info, logger)

        self._detected = 0

        ###
        # The i2c RAM lives at address 0x50 on bus 0; look for it.
        result, spewage = execute_command('/usr/bin/i2cdetect 0 | grep -q 50')
        if result:
            self._detected = 1

        return
示例#12
0
    def __init__(self, config, hw_info, logger):
        TestMethods.__init__(self, "I2C RAM", config, hw_info, logger)

        self._detected = 0

        ###
        # The i2c RAM lives at address 0x50 on bus 0; look for it.
        result, spewage = execute_command("/usr/bin/i2cdetect 0 | grep -q 50")
        if result:
            self._detected = 1

        return
示例#13
0
    def __init__(self):
        super(_I2CRtc, self).__init__()
        self._test_name = 'I2C RTC'
        self._detected = 0
        self._rtc_regs = _I2CRtc_Registers()

        ###
        # I have seen during tests, the chip will occasionally look like it
        # has gone south (see _I2CRtc_Registers::is_dead), but then magically
        # resurrects itself.  We'll allow this to happen a certain number of
        # *consecutive* times before pronouncing the chip fubar.
        self._rtc_death_watch = 0
        self._rtc_death_toll = 0
        self._rtc_num_lives = 5

        ###
        # We have to be careful about this.  I think the time.sleep() uses
        # the system clock, anything longer than this and we might see
        # too much drift in wall time.
        self._rtc_test_duration = 30
        self._rtc_test_tolerance = 2

        ###
        # The i2c RTC lives at address 0x68 on bus 0; look for it.
        result, spewage = execute_command('/usr/bin/i2cdetect 0 | grep -q 68')
        if result:
            self._detected = 1

        ####
        # Benchmark the overhead of the system call so we can deduct this
        # overhead from the final RTC time tests.  Ten iterations should be
        # sufficient, we're not controlling nuclear power.
        #
        # TBD: Measure this once and store, or each time we test the RTC?
        #
        # I would prefer to err on the side of caution and measure it each
        # iteration, but so far results have proven reliable measuring once
        # and storing the overhead.
        delta_t = 0.0
        for iteration in range(0, 10):
            start_t = time.clock()
            sec, min, hrs = self._rtc_regs.get_time()
            end_t = time.clock()

            ###
            # The value we get back from 'clocks' is in processor units.  On
            # x86 Linux, there are 100 processor units per second in
            # userspace (HZ in include/asm-i386/param.h).
            delta_t += ((end_t - start_t) * 100)
        self.overhead = int(math.ceil(delta_t / 10.0))
        return
示例#14
0
文件: i2c.py 项目: mcruse/monotone
    def __init__(self):
        super(_I2CRtc, self).__init__()
        self._test_name = 'I2C RTC'
        self._detected = 0
        self._rtc_regs = _I2CRtc_Registers()
        
        ###
        # I have seen during tests, the chip will occasionally look like it
        # has gone south (see _I2CRtc_Registers::is_dead), but then magically
        # resurrects itself.  We'll allow this to happen a certain number of
        # *consecutive* times before pronouncing the chip fubar.
        self._rtc_death_watch = 0
        self._rtc_death_toll = 0
        self._rtc_num_lives = 5

        ###
        # We have to be careful about this.  I think the time.sleep() uses
        # the system clock, anything longer than this and we might see
        # too much drift in wall time.
        self._rtc_test_duration = 30
        self._rtc_test_tolerance = 2

        ###
        # The i2c RTC lives at address 0x68 on bus 0; look for it.
        result, spewage = execute_command('/usr/bin/i2cdetect 0 | grep -q 68')
        if result:
            self._detected = 1

        ####
        # Benchmark the overhead of the system call so we can deduct this
        # overhead from the final RTC time tests.  Ten iterations should be
        # sufficient, we're not controlling nuclear power.
        #
        # TBD: Measure this once and store, or each time we test the RTC?
        #
        # I would prefer to err on the side of caution and measure it each
        # iteration, but so far results have proven reliable measuring once
        # and storing the overhead.
        delta_t = 0.0
        for iteration in range(0, 10):
            start_t = time.clock()
            sec, min, hrs = self._rtc_regs.get_time()
            end_t = time.clock()

            ###
            # The value we get back from 'clocks' is in processor units.  On
            # x86 Linux, there are 100 processor units per second in
            # userspace (HZ in include/asm-i386/param.h).
            delta_t += ((end_t - start_t) * 100)
        self.overhead = int(math.ceil(delta_t / 10.0))
        return
示例#15
0
文件: i2c.py 项目: mcruse/monotone
 def runtest(self):
     if properties.HARDWARE_CODENAME == "Megatron":
         return self.passed()
     ###
     # Make sure we can "see" the i2c bus before attempting to test
     # attached components, duh.  (We're only interested in bus 0.)
     result, spewage = execute_command('/usr/bin/i2cdetect 0')
     if not result:
         self.log('ERROR: Cannot access the I2C bus: %s' % spewage)
         self._nerrors += 1
     else:
         self._i2crtc.runtest()
         self._nwarnings += self._i2crtc.nwarnings
         self._nerrors += self._i2crtc.nerrors
     return self.passed()
示例#16
0
 def runtest(self):
     if properties.HARDWARE_CODENAME == "Megatron":
         return self.passed()
     ###
     # Make sure we can "see" the i2c bus before attempting to test
     # attached components, duh.  (We're only interested in bus 0.)
     result, spewage = execute_command('/usr/bin/i2cdetect 0')
     if not result:
         self.log('ERROR: Cannot access the I2C bus: %s' % spewage)
         self._nerrors += 1
     else:
         self._i2crtc.runtest()
         self._nwarnings += self._i2crtc.nwarnings
         self._nerrors += self._i2crtc.nerrors
     return self.passed()
示例#17
0
    def _run_ping(self):
        msg_testing('  Ping testing eth%d....................................................' % self._eth_port)

        result, spewage = execute_command('ping -I eth%d -c %d %s' %
                                           (self._eth_port, self._ping_count, self._ping_host))
        if result:
            msg_pass()
        else:
            self._nerrors += 1

            ###
            # NOTE: We can't log 'spewage' here because there are extra
            # percent symbols embedded in PING's response which throws off
            # the logger's string handling.
            self._logger.log('ERROR: Ping test on eth%d failed\n' % self._eth_port)

            msg_fail()
示例#18
0
    def runtest(self, burnin=0):
        ###
        # Make sure we can "see" the i2c bus before attempting to test
        # attached components, duh.  (We're only interested in bus 0.)
        result, spewage = execute_command("/usr/bin/i2cdetect 0")
        if not result:
            self._logger.log("ERROR: Cannot access the I2C bus: %s\n" % spewage)
            self._nerrors += 1
            print "I2C bus tests FAILED"
            return

        # self._i2cmem.runtest(burnin)
        # self._nerrors += self._i2cmem.nerrors()

        self._i2crtc.runtest(burnin)
        self._nwarnings += self._i2crtc.nwarnings()
        self._nerrors += self._i2crtc.nerrors()
示例#19
0
    def _run_netperf(self, cable_len = 0):
        msg_testing('\nConnect a %dM cable to eth%d and press enter...' % (cable_len, self._eth_port))
        sys.stdin.readline()

        msg_testing('Testing eth%d with a %dM cable (about five minutes)....................' % (self._eth_port, cable_len))

        result, spewage = execute_command('/usr/bin/mediator_test %s %s' %
                                           (self._netperf_server, self._netperf_server_port))
        if result:
            msg_pass()
        else:
            self._nerrors += 1

            self._logger.log('ERROR: %dM cable on eth%d test failed:' % (cable_len, self._eth_port))
            for line in spewage:
                self._logger.log(line)

            msg_fail()
示例#20
0
    def runtest(self, burnin=0):
        ###
        # Make sure we can "see" the i2c bus before attempting to test
        # attached components, duh.  (We're only interested in bus 0.)
        result, spewage = execute_command('/usr/bin/i2cdetect 0')
        if not result:
            self._logger.log('ERROR: Cannot access the I2C bus: %s\n' %
                             spewage)
            self._nerrors += 1
            print 'I2C bus tests FAILED'
            return

        #self._i2cmem.runtest(burnin)
        #self._nerrors += self._i2cmem.nerrors()

        self._i2crtc.runtest(burnin)
        self._nwarnings += self._i2crtc.nwarnings()
        self._nerrors += self._i2crtc.nerrors()
示例#21
0
文件: memory.py 项目: mcruse/monotone
    def runtest(self, burnin = 0):
        if burnin:
            msg_testing('Testing system RAM, this will take about two minutes...................')
        else:
            if not self._test_prog_logged:
                self._logger.log("Memory test program: \"%s\"\n" % self._testprog)
                self._test_prog_logged = 1

            msg_testing('Testing system RAM, this will take about 10 minutes....................')

        result, spewage = execute_command(self._testprog)
        if result:
            msg_pass()
        else:
            self._nerrors += 1
            self._logger.log('ERROR: Memory test failed:\n%s' % spewage)
            msg_fail()

        return
示例#22
0
    def runtest(self, burnin=0):
        if not self._detected:
            return

        msg_testing("Testing the i2c sensor chip (LM75).....................................")

        ###
        # By specifying the exact address of the LM75 sensor we can force
        # the 'sensors' program to not get cute and search for any kind
        # of sensor.  If there isn't a functional LM75 at i2c bus 0
        # address 0x4a, then 'sensors' will return a failure.
        result, spewage = execute_command("/usr/bin/sensors lm75-i2c-0-4a")
        if 1:  # result:
            msg_pass()
        else:
            self._nerrors += 1
            self._logger.log("ERROR: LM75 test failed: %s\n" % spewage)
            msg_fail()

        return
示例#23
0
    def _run_ping(self):
        msg_testing(
            '  Ping testing eth%d....................................................'
            % self._eth_port)

        result, spewage = execute_command(
            'ping -I eth%d -c %d %s' %
            (self._eth_port, self._ping_count, self._ping_host))
        if result:
            msg_pass()
        else:
            self._nerrors += 1

            ###
            # NOTE: We can't log 'spewage' here because there are extra
            # percent symbols embedded in PING's response which throws off
            # the logger's string handling.
            self._logger.log('ERROR: Ping test on eth%d failed\n' %
                             self._eth_port)

            msg_fail()
示例#24
0
    def runtest(self, burnin=0):
        if not self._detected:
            return

        msg_testing("Testing the i2c RAM CHIP.................................................")

        ###
        # The i2cset program reads back after writing to make sure that
        # the write operation was successful.  If not, then we get back
        # an error code.  Therefore it is not necessary to do a read
        # and parse the results.  Nifty, huh?
        result, spewage = execute_command("/usr/bin/i2cset 0 0x50 0 0xff")
        if result:
            msg_pass()
            return
        else:
            self._nerrors += 1
            self._logger.log("ERROR: memory test failed: %s" % spewage)
            msg_fail()

        return
示例#25
0
    def runtest(self, burnin=0):
        if self._detected:
            msg_testing("Testing the i2c RTC chip (DS1307), this will take about two minutes....")

            ###
            # My modifications to 'hwclock' for the i2c clock will NOT fall
            # back to the ISA (internal) hardware clock for Geode platforms.
            #
            # Therefore, 'hwclock' will fail if either:
            #     Cannot access i2c bus -or-
            #     The IOCTL in the i2c driver craps out
            result, spewage = execute_command("/sbin/hwclock --utc")
            if not result:
                msg_fail()
                self._nerrors += 1
                self._logger.log("ERROR: RTC tests failed: %s" % spewage)
                return

            self._time_rtc()

        return
示例#26
0
    def runtest(self, burnin=0):
        if not self._detected:
            return

        msg_testing(
            'Testing the i2c sensor chip (LM75).....................................'
        )

        ###
        # By specifying the exact address of the LM75 sensor we can force
        # the 'sensors' program to not get cute and search for any kind
        # of sensor.  If there isn't a functional LM75 at i2c bus 0
        # address 0x4a, then 'sensors' will return a failure.
        result, spewage = execute_command('/usr/bin/sensors lm75-i2c-0-4a')
        if 1:  #result:
            msg_pass()
        else:
            self._nerrors += 1
            self._logger.log('ERROR: LM75 test failed: %s\n' % spewage)
            msg_fail()

        return
示例#27
0
    def runtest(self):
        if not self._detected:
            self.log('ERROR: The i2c RTC was not detected')
            self._nerrors += 1
            return

        self.log('Testing the i2c RTC chip (DS1307).')
        ###
        # My modifications to 'hwclock' for the i2c clock will NOT fall
        # back to the ISA (internal) hardware clock for Geode platforms.
        #
        # Therefore, 'hwclock' will fail if either:
        #     Cannot access i2c bus -or-
        #     The IOCTL in the i2c driver craps out
        result, spewage = execute_command('/sbin/hwclock --utc')
        if not result:
            self._nerrors += 1
            self.log('ERROR: RTC tests failed: %s' % spewage)
            return
        self._time_rtc()
        self.log('I2C test found %d errors and %d warnings.' % \
            (self._nerrors, self._nwarnings))
        return
示例#28
0
    def _run_netperf(self, cable_len=0):
        msg_testing('\nConnect a %dM cable to eth%d and press enter...' %
                    (cable_len, self._eth_port))
        sys.stdin.readline()

        msg_testing(
            'Testing eth%d with a %dM cable (about five minutes)....................'
            % (self._eth_port, cable_len))

        result, spewage = execute_command(
            '/usr/bin/mediator_test %s %s' %
            (self._netperf_server, self._netperf_server_port))
        if result:
            msg_pass()
        else:
            self._nerrors += 1

            self._logger.log('ERROR: %dM cable on eth%d test failed:' %
                             (cable_len, self._eth_port))
            for line in spewage:
                self._logger.log(line)

            msg_fail()
示例#29
0
文件: i2c.py 项目: mcruse/monotone
 def runtest(self):
     if not self._detected:
         self.log('ERROR: The i2c RTC was not detected')
         self._nerrors += 1
         return
     
     self.log('Testing the i2c RTC chip (DS1307).')
     ###
     # My modifications to 'hwclock' for the i2c clock will NOT fall
     # back to the ISA (internal) hardware clock for Geode platforms.
     #
     # Therefore, 'hwclock' will fail if either:
     #     Cannot access i2c bus -or-
     #     The IOCTL in the i2c driver craps out
     result, spewage = execute_command('/sbin/hwclock --utc')
     if not result:
         self._nerrors += 1
         self.log('ERROR: RTC tests failed: %s' % spewage)
         return
     self._time_rtc()
     self.log('I2C test found %d errors and %d warnings.' % \
         (self._nerrors, self._nwarnings))
     return
示例#30
0
    def runtest(self, burnin=0):
        if not self._detected:
            return

        msg_testing(
            'Testing the i2c RAM CHIP.................................................'
        )

        ###
        # The i2cset program reads back after writing to make sure that
        # the write operation was successful.  If not, then we get back
        # an error code.  Therefore it is not necessary to do a read
        # and parse the results.  Nifty, huh?
        result, spewage = execute_command('/usr/bin/i2cset 0 0x50 0 0xff')
        if result:
            msg_pass()
            return
        else:
            self._nerrors += 1
            self._logger.log('ERROR: memory test failed: %s' % spewage)
            msg_fail()

        return
示例#31
0
    def runtest(self, burnin=0):
        if self._detected:
            msg_testing(
                'Testing the i2c RTC chip (DS1307), this will take about two minutes....'
            )

            ###
            # My modifications to 'hwclock' for the i2c clock will NOT fall
            # back to the ISA (internal) hardware clock for Geode platforms.
            #
            # Therefore, 'hwclock' will fail if either:
            #     Cannot access i2c bus -or-
            #     The IOCTL in the i2c driver craps out
            result, spewage = execute_command('/sbin/hwclock --utc')
            if not result:
                msg_fail()
                self._nerrors += 1
                self._logger.log('ERROR: RTC tests failed: %s' % spewage)
                return

            self._time_rtc()

        return
示例#32
0
    def runtest(self, burnin=0):
        if burnin:
            msg_testing(
                'Testing system RAM, this will take about two minutes...................'
            )
        else:
            if not self._test_prog_logged:
                self._logger.log("Memory test program: \"%s\"\n" %
                                 self._testprog)
                self._test_prog_logged = 1

            msg_testing(
                'Testing system RAM, this will take about 10 minutes....................'
            )

        result, spewage = execute_command(self._testprog)
        if result:
            msg_pass()
        else:
            self._nerrors += 1
            self._logger.log('ERROR: Memory test failed:\n%s' % spewage)
            msg_fail()

        return
示例#33
0
    def _runtest(self):
        message('Executing modem tests:')

        if not os.access('/tmp/test.fil', os.F_OK):
            os.system(
                'dd if=/dev/zero of=/tmp/test.file bs=64k count=1 1>/dev/null 2>/dev/null'
            )

        msg_testing('  Starting PPP...')
        os.system('/etc/ppp/ppp-on')

        ####
        # We don't get any feedback from pppd or chat regarding success or
        # failure of bringing up a PPP interface (ppp0 in our case).  So, wait
        # for 45 seconds and see if ppp0 exists.
        time.sleep(45)
        result, spewage = execute_command('ifconfig ppp0')
        if not result:
            msg_fail()
            self._nerrors += 1
            self._logger.log('ERROR: ppp did not start: %s\n' % spewage)
            return 0
        message('done.')

        msg_testing('  Sending file...', )
        result, spewage = execute_command(
            'scp /tmp/test.file [email protected]:/tmp/.')
        # MAGIC NUMBER ALERT!!!....................................^^^^^^^^^^^^^
        if not result:
            msg_fail()
            self._nerrors += 1
            self._logger.log('ERROR: scp to host failed: %s\n' % spewage)
            return 0
        message('done.')

        msg_testing('  Retrieving file...')
        result, spewage = execute_command(
            'scp [email protected]:/tmp/test.file .')
        # MAGIC NUMBER ALERT!!!.....................^^^^^^^^^^^^^
        os.unlink('./test.file')
        if not result:
            msg_fail()
            self._nerrors += 1
            self._logger.log('ERROR: scp from host failed: %s\n' % spewage)
            return 0
        message('done.')

        msg_testing('  Deleting file on remote system...')
        result, spewage = execute_command(
            'ssh [email protected] rm -f /tmp/test.file')
        # MAGIC NUMBER ALERT!!!.....................^^^^^^^^^^^^^
        if not result:
            msg_fail()
            self._nerrors += 1
            self._logger.log('ERROR: ssh on host failed: %s\n' % spewage)
            return 0
        message('done.')

        msg_testing('  Stopping PPP...')
        os.system('/etc/ppp/ppp-off 1>/dev/null 2>/dev/null')
        message('done.')

        return 1