2003-06-11 22:42:40 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
## $Id$
|
|
|
|
|
|
|
|
# This tests whether the most basic mechanisms are working Also whether stderr
|
|
|
|
# output is reported correctly Also tests if water levels are working
|
|
|
|
# correctly
|
|
|
|
|
|
|
|
from boinc import *
|
|
|
|
|
2003-06-19 00:19:22 +00:00
|
|
|
class UserUC(User):
|
2003-06-11 22:42:40 +00:00
|
|
|
def __init__(self):
|
2003-06-19 00:19:22 +00:00
|
|
|
User.__init__(self)
|
|
|
|
self.project_prefs = "<project_specific>\nfoobar\n</project_specific>"
|
|
|
|
self.global_prefs = """<venue name=\"home\">
|
2003-06-11 22:42:40 +00:00
|
|
|
<work_buf_min_days>0</work_buf_min_days>
|
|
|
|
<work_buf_max_days>2</work_buf_max_days>
|
|
|
|
<disk_interval>1</disk_interval>
|
|
|
|
<run_on_batteries/>
|
|
|
|
<max_bytes_sec_down>400000</max_bytes_sec_down>
|
2003-06-18 22:11:53 +00:00
|
|
|
</venue>"""
|
2003-06-11 22:42:40 +00:00
|
|
|
|
2003-06-19 00:19:22 +00:00
|
|
|
class WorkUC(Work):
|
|
|
|
def __init__(self, redundancy=2):
|
|
|
|
Work.__init__(self)
|
|
|
|
self.wu_template = "uc_wu"
|
|
|
|
self.result_template = "uc_result"
|
|
|
|
self.redundancy = redundancy
|
|
|
|
self.delay_bound = 5*redundancy
|
|
|
|
self.input_files = ['input']
|
2003-06-24 22:50:14 +00:00
|
|
|
# # Say that 1 WU takes 1 day on a ref comp
|
|
|
|
# - note: for test_1sec these values are too high so if you want to
|
|
|
|
# add these back, make them smaller of make test_1sec
|
|
|
|
# request more work
|
|
|
|
# self.rsc_fpops = 86400*1e9/2
|
|
|
|
# self.rsc_iops = 86400*1e9/2
|
|
|
|
# self.rsc_disk = 10e8
|
2003-06-11 22:42:40 +00:00
|
|
|
|
2003-06-19 02:01:18 +00:00
|
|
|
class ResultUC:
|
|
|
|
def __init__(self):
|
|
|
|
self.server_state = RESULT_SERVER_STATE_OVER
|
2003-06-30 21:59:18 +00:00
|
|
|
self.client_state = RESULT_FILES_UPLOADED
|
|
|
|
self.outcome = RESULT_OUTCOME_SUCCESS
|
2003-06-28 00:56:45 +00:00
|
|
|
self.stderr_out = MATCH_REGEXPS([ """<stderr_txt>
|
|
|
|
APP: upper_case: starting, argc \\d+
|
|
|
|
APP: upper_case: argv[[]0[]] is upper_case
|
|
|
|
APP: upper_case ending, wrote \\d+ chars"""])
|
2003-06-19 02:01:18 +00:00
|
|
|
# self.exit_status = 0
|
|
|
|
|
2003-06-28 00:56:45 +00:00
|
|
|
class ResultUCError:
|
|
|
|
def __init__(self):
|
2003-06-30 21:59:18 +00:00
|
|
|
self.server_state = RESULT_SERVER_STATE_OVER
|
|
|
|
self.client_state = RESULT_COMPUTE_DONE
|
|
|
|
self.outcome = RESULT_OUTCOME_CLIENT_ERROR
|
2003-06-28 00:56:45 +00:00
|
|
|
self.stderr_out = MATCH_REGEXPS([ """<stderr_txt>
|
|
|
|
APP: upper_case: starting, argc \\d+"""])
|
2003-06-24 21:06:32 +00:00
|
|
|
|
2003-06-19 00:19:22 +00:00
|
|
|
class ProjectUC(Project):
|
|
|
|
def __init__(self, works=None, users=None, hosts=None,
|
2003-06-19 02:01:18 +00:00
|
|
|
short_name=None, long_name=None,
|
2003-06-24 21:06:32 +00:00
|
|
|
redundancy=2, resource_share=1):
|
2003-06-19 00:19:22 +00:00
|
|
|
Project.__init__(self,
|
|
|
|
appname = 'upper_case',
|
2003-06-19 02:01:18 +00:00
|
|
|
works = works or [WorkUC(redundancy=redundancy)],
|
2003-06-19 00:19:22 +00:00
|
|
|
users = users or [UserUC()],
|
|
|
|
hosts = hosts,
|
2003-06-24 21:06:32 +00:00
|
|
|
short_name=short_name, long_name=long_name,
|
2003-06-26 00:20:44 +00:00
|
|
|
redundancy=redundancy, resource_share=resource_share
|
2003-06-24 21:06:32 +00:00
|
|
|
)
|
2003-06-11 22:42:40 +00:00
|
|
|
|
2003-06-28 00:56:45 +00:00
|
|
|
def check(self, result=ResultUC()):
|
|
|
|
'''Check results uploaded correctly'''
|
2003-06-26 00:20:44 +00:00
|
|
|
self.sched_run('validate_test')
|
2003-06-28 00:56:45 +00:00
|
|
|
self.check_results(result)
|
2003-06-26 00:20:44 +00:00
|
|
|
self.check_files_match("upload/uc_wu_%d_0", "uc_correct_output", count=self.redundancy)
|
|
|
|
self.sched_run('assimilator')
|
|
|
|
self.sched_run('file_deleter')
|
2003-06-18 22:11:53 +00:00
|
|
|
self.check_deleted("download/input")
|
2003-06-26 00:20:44 +00:00
|
|
|
self.check_deleted("upload/uc_wu_%d_0", count=self.redundancy)
|
2003-06-19 00:19:22 +00:00
|
|
|
|
2003-06-28 00:56:45 +00:00
|
|
|
def check_client_error(self, result=ResultUCError()):
|
|
|
|
'''Check no results uploaded'''
|
|
|
|
self.check_deleted("upload/uc_wu_%d_0", count=self.redundancy)
|
|
|
|
self.sched_run('validate_test')
|
|
|
|
self.check_results(result)
|
|
|
|
self.sched_run('assimilator')
|
|
|
|
self.sched_run('file_deleter')
|
|
|
|
|
2003-06-19 00:19:22 +00:00
|
|
|
def run(self):
|
|
|
|
self.install()
|
2003-06-26 00:20:44 +00:00
|
|
|
self.sched_install('feeder')
|
2003-06-19 00:19:22 +00:00
|
|
|
self.start_servers()
|
2003-06-11 22:42:40 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
test_msg("standard upper_case application");
|
2003-06-24 21:06:32 +00:00
|
|
|
ProjectUC()
|
|
|
|
run_check_all()
|