units.py (11879:7388b21d7eac) | units.py (12142:f6ccdb328a23) |
---|---|
1#!/usr/bin/env python2 2# 3# Copyright (c) 2016 ARM Limited 4# All rights reserved 5# 6# The license below extends only to copyright in the software and shall 7# not be construed as granting a license to any other intellectual 8# property including but not limited to intellectual property relating --- 256 unchanged lines hidden (view full) --- 265 """Test unit comparing two gem5 stat files.""" 266 267 def __init__(self, **kwargs): 268 super(DiffStatFile, self).__init__("stat_diff", **kwargs) 269 270 self.stat_diff = os.path.join(_test_base, "diff-out") 271 272 def _run(self): | 1#!/usr/bin/env python2 2# 3# Copyright (c) 2016 ARM Limited 4# All rights reserved 5# 6# The license below extends only to copyright in the software and shall 7# not be construed as granting a license to any other intellectual 8# property including but not limited to intellectual property relating --- 256 unchanged lines hidden (view full) --- 265 """Test unit comparing two gem5 stat files.""" 266 267 def __init__(self, **kwargs): 268 super(DiffStatFile, self).__init__("stat_diff", **kwargs) 269 270 self.stat_diff = os.path.join(_test_base, "diff-out") 271 272 def _run(self): |
273 STATUS_OK = 0 274 STATUS_NEW_STATS = 1 275 STATUS_FAILED = 2 276 |
|
273 stats = "stats.txt" 274 275 cmd = [ 276 self.stat_diff, 277 self.ref_file(stats), self.out_file(stats), 278 ] 279 with ProcessHelper(cmd, 280 stdout=subprocess.PIPE, 281 stderr=subprocess.PIPE) as p: 282 status, stdout, stderr = p.call() 283 | 277 stats = "stats.txt" 278 279 cmd = [ 280 self.stat_diff, 281 self.ref_file(stats), self.out_file(stats), 282 ] 283 with ProcessHelper(cmd, 284 stdout=subprocess.PIPE, 285 stderr=subprocess.PIPE) as p: 286 status, stdout, stderr = p.call() 287 |
284 if status == 0: | 288 if status in (STATUS_OK, STATUS_NEW_STATS): |
285 return self.ok(stdout=stdout, stderr=stderr) | 289 return self.ok(stdout=stdout, stderr=stderr) |
286 if status == 1: | 290 elif status == STATUS_FAILED: |
287 return self.failure("Statistics mismatch", 288 stdout=stdout, stderr=stderr) 289 else: 290 return self.error("diff-out returned an error: %i" % status, 291 stdout=stdout, stderr=stderr) | 291 return self.failure("Statistics mismatch", 292 stdout=stdout, stderr=stderr) 293 else: 294 return self.error("diff-out returned an error: %i" % status, 295 stdout=stdout, stderr=stderr) |