Skip to content

Commit

Permalink
Added lcd messages to all startup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
faebser committed Oct 20, 2015
1 parent 0d79442 commit b05ef33
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
15 changes: 10 additions & 5 deletions startup_tests/disk_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ class DiskSpaceTest(TestClass):
def run_test(self):
st = os.statvfs('/') # root file system
result = st.f_bavail * st.f_frsize/1024/1024
if result < 1000:
return TestStatus.Attention, u'There are {} MB available. Please free up some space.'.format(result)
elif result < 10:
return TestStatus.Error, u'There are only {} MB available. Please free up some space.'.format(result)
minutes = result
if result <= 999:
return TestStatus.Attention, \
u'There are {} MB available. That is enough for {} minutes of MP3'.format(result, minutes), \
u"{} MB left\n{} min left".format(result, minutes)
elif result <= 99:
return TestStatus.Error, \
u'There are only {} MB available, that is just {} minutes of MP*. Please free up some space.'.format(result), \
u"Critical only\n{}MB {}min left".format(result, minutes)
else:
return TestStatus.Good, u'There are {} MB of free space available.'.format(result)
return TestStatus.Good, u'There are {} MB of free space available.'.format(result), u""
10 changes: 7 additions & 3 deletions startup_tests/ip_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ def run_test(self):
try:
ip = get_ip_address('eth0')
except IOError:
return TestStatus.Attention, 'Network interface eth0 is not available'
return TestStatus.Attention, \
u'Network interface eth0 is not available', \
u"No network\nconnection"
if '192.168' in ip:
return TestStatus.Good, 'My IP-Address in private range: {})'.format(ip)
return TestStatus.Good, 'My IP-Address in private range: {})'.format(ip), u''
else:
return TestStatus.Attention, 'My IP-Address should start with 192.168. But it is {}'.format(ip)
return TestStatus.Attention, \
'My IP-Address should start with 192.168. But it is {}'.format(ip), \
u"Target = 192.168\n{}".format(ip)
9 changes: 6 additions & 3 deletions startup_tests/usb_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ def run_test(self):
audio_list = subprocess.Popen('aplay -l', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = audio_list.communicate()
if error != '':
return TestStatus.Error, u'There is problem related to the USB-Audio: {}'.format(error)
return TestStatus.Error, u'There is problem related to the USB-Audio: {}'.format(error), \
u"USB Audio error:\n{}".format(error)
for line in output.splitlines():
if 'USB Audio' in line:
return TestStatus.Good, u'I have a USB-Audio device connected'
return TestStatus.Attention, u"I can't find a USB-Audio device. Please make sure that it is plugged in"
return TestStatus.Good, u'I have a USB-Audio device connected', u''
return TestStatus.Attention, \
u"I can't find a USB-Audio device. Please make sure that it is plugged in", \
u"Can't find\nUSB audio"

0 comments on commit b05ef33

Please sign in to comment.