2003-06-11 22:42:40 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
## $Id$
|
|
|
|
|
2003-10-10 20:10:18 +00:00
|
|
|
# This tests whether the most basic mechanisms are working
|
|
|
|
# Also whether stderr output is reported correctly
|
|
|
|
# Also tests if work buffer limits are working correctly
|
2003-06-11 22:42:40 +00:00
|
|
|
|
2003-07-18 21:43:12 +00:00
|
|
|
from testbase import *
|
2003-06-11 22:42:40 +00:00
|
|
|
|
2003-06-19 00:19:22 +00:00
|
|
|
class UserUC(User):
|
2003-10-03 05:53:28 +00:00
|
|
|
def init(self):
|
|
|
|
self.User.__init__()
|
|
|
|
self.project_prefs = """<project_preferences>
|
|
|
|
<project_specific>
|
|
|
|
foobar
|
|
|
|
</project_specific>
|
|
|
|
</project_preferences>
|
|
|
|
"""
|
|
|
|
self.global_prefs = """<global_preferences>
|
|
|
|
<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-10-03 05:53:28 +00:00
|
|
|
</venue>
|
|
|
|
</global_preferences>
|
|
|
|
"""
|
2003-06-11 22:42:40 +00:00
|
|
|
|
2003-06-19 00:19:22 +00:00
|
|
|
class WorkUC(Work):
|
2003-08-18 22:34:53 +00:00
|
|
|
def __init__(self, redundancy, **kwargs):
|
|
|
|
Work.__init__(self, redundancy=redundancy)
|
2003-06-19 00:19:22 +00:00
|
|
|
self.wu_template = "uc_wu"
|
|
|
|
self.result_template = "uc_result"
|
|
|
|
self.input_files = ['input']
|
2003-08-15 23:04:36 +00:00
|
|
|
self.__dict__.update(kwargs)
|
2003-06-11 22:42:40 +00:00
|
|
|
|
2003-10-03 05:53:28 +00:00
|
|
|
class ResultUC(ExpectedResult):
|
2003-06-19 02:01:18 +00:00
|
|
|
def __init__(self):
|
2003-10-10 05:48:25 +00:00
|
|
|
ExpectedResult.__init__(self)
|
2003-08-22 00:15:51 +00:00
|
|
|
self.stderr_out = MATCH_REGEXPS([
|
2003-10-10 05:48:25 +00:00
|
|
|
"<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
|
|
|
|
2003-10-03 05:53:28 +00:00
|
|
|
class ResultComputeErrorUC(ExpectedResultComputeError):
|
2003-06-28 00:56:45 +00:00
|
|
|
def __init__(self):
|
2003-10-10 05:48:25 +00:00
|
|
|
ExpectedResultComputeError.__init__(self)
|
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-08-18 22:34:53 +00:00
|
|
|
## TODO: check that uc_wu_%d_0 matches uc_correct_output BEFORE deleted by
|
|
|
|
## file deleter!
|
|
|
|
|
2003-07-18 21:43:12 +00:00
|
|
|
class ProjectUC(TestProject):
|
2003-08-18 22:34:53 +00:00
|
|
|
def __init__(self,
|
|
|
|
num_wu=None, redundancy=None,
|
|
|
|
expect_success=True,
|
|
|
|
works=None, users=None, hosts=None,
|
2003-06-19 02:01:18 +00:00
|
|
|
short_name=None, long_name=None,
|
2003-08-18 22:34:53 +00:00
|
|
|
resource_share=1):
|
|
|
|
(num_wu, redundancy) = get_redundancy_args(num_wu, redundancy)
|
2003-07-18 21:43:12 +00:00
|
|
|
TestProject.__init__(self,
|
|
|
|
appname = 'upper_case',
|
2003-08-18 22:34:53 +00:00
|
|
|
num_wu=num_wu, redundancy=redundancy,
|
|
|
|
expected_result = (expect_success and ResultUC() or ResultComputeErrorUC()),
|
2003-07-18 21:43:12 +00:00
|
|
|
works = works or [WorkUC(redundancy=redundancy)],
|
|
|
|
users = users or [UserUC()],
|
|
|
|
hosts = hosts,
|
|
|
|
short_name=short_name, long_name=long_name,
|
2003-08-18 22:34:53 +00:00
|
|
|
resource_share=resource_share
|
2003-07-18 21:43:12 +00:00
|
|
|
)
|
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()
|