diff options
author | jamesren <jamesren@592f7852-d20e-0410-864c-8624ca9c26a4> | 2010-06-10 23:55:06 +0000 |
---|---|---|
committer | jamesren <jamesren@592f7852-d20e-0410-864c-8624ca9c26a4> | 2010-06-10 23:55:06 +0000 |
commit | 1f749b8d7022c164cf4f0cf596564d32b650e021 (patch) | |
tree | 3e2034a46a3bf6383afe2385c26ed23d8fde7e8d /tko | |
parent | 0e15f98ba173bbdc955d0e50ac456f8518e7c436 (diff) |
Fixed tko.proto to have inner message 'classes' to serialize correctly. Fixed Status setup in job_serializer_unittest.
OK to submit to non-main branch.
Signed-off-by: Darren Kuo <darrenkuo@google.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@4599 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko')
-rw-r--r-- | tko/job_serializer.py | 4 | ||||
-rw-r--r-- | tko/job_serializer_unittest.py | 12 | ||||
-rw-r--r-- | tko/tko.proto | 80 |
3 files changed, 50 insertions, 46 deletions
diff --git a/tko/job_serializer.py b/tko/job_serializer.py index 55c1169c..5f0fcf7e 100644 --- a/tko/job_serializer.py +++ b/tko/job_serializer.py @@ -77,7 +77,7 @@ class JobSerializer(object): be returned. """ - job_pb = tko_pb2.job() + job_pb = tko_pb2.Job() binary = open(infile, 'r') try: @@ -109,7 +109,7 @@ class JobSerializer(object): binary of the serialized object. """ - job_pb = tko_pb2.job() + job_pb = tko_pb2.Job() self.set_pb_job(the_job, job_pb) out = open(binaryfilename, 'wb') diff --git a/tko/job_serializer_unittest.py b/tko/job_serializer_unittest.py index 368e584c..14e854d7 100644 --- a/tko/job_serializer_unittest.py +++ b/tko/job_serializer_unittest.py @@ -32,7 +32,7 @@ class JobSerializerUnittest(unittest.TestCase): tko_kernel = models.kernel('tubes', tko_patches, '1234567') tko_time = datetime.now() - tko_job = models.job('/tmp/', 'root', 'test', 'My Computer', + tko_job = models.job('/tmp/', 'darrenkuo', 'test', 'My Computer', tko_time, tko_time, tko_time, 'root', 'www', 'No one', tko_time, {'1+1':2}) @@ -41,7 +41,7 @@ class JobSerializerUnittest(unittest.TestCase): tko_labels = ['unittest', 'dummy test', 'autotest'] - tko_test = models.test('/tmp/', 'mocktest', 'PASS', 'N/A', + tko_test = models.test('/tmp/', 'mocktest', 'Completed', 'N/A', tko_kernel, 'My Computer', tko_time, tko_time, [tko_iteration, tko_iteration, tko_iteration], @@ -50,7 +50,7 @@ class JobSerializerUnittest(unittest.TestCase): self.tko_job = tko_job self.tko_job.tests = [tko_test, tko_test, tko_test] - self.pb_job = tko_pb2.job() + self.pb_job = tko_pb2.Job() js = job_serializer.JobSerializer() js.set_pb_job(self.tko_job, self.pb_job) @@ -237,7 +237,7 @@ class ReadBackTest(JobSerializerUnittest): binary = open(out_binary.name, 'rb') try: - self.pb_job = tko_pb2.job() + self.pb_job = tko_pb2.Job() self.pb_job.ParseFromString(binary.read()) finally: binary.close() @@ -258,7 +258,9 @@ class ReadBackGetterTest(JobSerializerUnittest): try: temp_binary.write(self.pb_job.SerializeToString()) temp_binary.flush() - + f = open('qa-job.serialize', 'wb') + f.write(self.pb_job.SerializeToString()) + f.close() js = job_serializer.JobSerializer() self.from_pb_job = js.deserialize_from_binary(temp_binary.name) finally: diff --git a/tko/tko.proto b/tko/tko.proto index 7f1af37a..8e775810 100644 --- a/tko/tko.proto +++ b/tko/tko.proto @@ -1,11 +1,45 @@ -message keyval { - required string name = 1; - required string value = 2; -} +syntax = "proto2"; + +message Job { + message KeyVal { + required string name = 1; + required string value = 2; + } + + message Kernel { + required string base = 1; + repeated Patch patches = 2; + required string kernel_hash = 3; + } + + message Patch { + required string spec = 1; + required string reference = 2; + required int64 hash = 3; + } + + message Iteration { + required int64 index = 1; + repeated KeyVal attr_keyval = 2; + repeated KeyVal perf_keyval = 3; + } + + message Test { + required string subdir = 1; + required string testname = 2; + required string status = 3; + required string reason = 4; + required Kernel kernel = 5; + required string machine = 6; + required int64 started_time = 7; + required int64 finished_time = 8; + repeated Iteration iterations = 9; + repeated KeyVal attributes = 10; + repeated string labels = 11; + } -message job { required string dir = 1; - repeated test tests = 2; + repeated Test tests = 2; required string user = 3; required string label = 4; required string machine = 5; @@ -16,37 +50,5 @@ message job { required string machine_group = 10; required string aborted_by = 11; required int64 aborted_on = 12; - repeated keyval keyval_dict = 13; -} - -message kernel { - required string base = 1; - repeated patch patches = 2; - required string kernel_hash = 3; -} - -message patch { - required string spec = 1; - required string reference = 2; - required int64 hash = 3; -} - -message iteration { - required int64 index = 1; - repeated keyval attr_keyval = 2; - repeated keyval perf_keyval = 3; -} - -message test { - required string subdir = 1; - required string testname = 2; - required string status = 3; - required string reason = 4; - required kernel kernel = 5; - required string machine = 6; - required int64 started_time = 7; - required int64 finished_time = 8; - repeated iteration iterations = 9; - repeated keyval attributes = 10; - repeated string labels = 11; + repeated KeyVal keyval_dict = 13; } |