diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-03-11 02:06:05 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-03-11 02:06:05 +0000 |
commit | 1f9654b4d51dacd6f652b4d0828a85d80346e4cc (patch) | |
tree | 73936aba47fe1dc71e9cc05af9747036e935608c /crosperf/machine_manager.py | |
parent | a95adb925ed4a1c0e6e8cb908e72284fb486bae5 (diff) | |
parent | 898f8d62d1305674635d1e341b5839154d4e6acd (diff) | |
download | toolchain-utils-android12-s3-release.tar.gz |
Snap for 7199033 from 898f8d62d1305674635d1e341b5839154d4e6acd to sc-releaseandroid-vts-12.0_r9android-vts-12.0_r8android-vts-12.0_r7android-vts-12.0_r6android-vts-12.0_r5android-vts-12.0_r4android-vts-12.0_r3android-vts-12.0_r2android-vts-12.0_r12android-vts-12.0_r11android-vts-12.0_r10android-vts-12.0_r1android-security-12.0.0_r60android-security-12.0.0_r59android-security-12.0.0_r58android-security-12.0.0_r57android-security-12.0.0_r56android-security-12.0.0_r55android-security-12.0.0_r54android-security-12.0.0_r53android-security-12.0.0_r52android-security-12.0.0_r51android-security-12.0.0_r50android-security-12.0.0_r49android-security-12.0.0_r48android-security-12.0.0_r47android-security-12.0.0_r46android-security-12.0.0_r45android-security-12.0.0_r44android-security-12.0.0_r43android-security-12.0.0_r42android-security-12.0.0_r41android-security-12.0.0_r40android-security-12.0.0_r39android-security-12.0.0_r38android-security-12.0.0_r37android-security-12.0.0_r36android-security-12.0.0_r35android-security-12.0.0_r34android-platform-12.0.0_r1android-cts-12.0_r9android-cts-12.0_r8android-cts-12.0_r7android-cts-12.0_r6android-cts-12.0_r5android-cts-12.0_r4android-cts-12.0_r3android-cts-12.0_r2android-cts-12.0_r12android-cts-12.0_r11android-cts-12.0_r10android-cts-12.0_r1android-12.0.0_r9android-12.0.0_r8android-12.0.0_r34android-12.0.0_r33android-12.0.0_r31android-12.0.0_r30android-12.0.0_r3android-12.0.0_r25android-12.0.0_r2android-12.0.0_r11android-12.0.0_r10android-12.0.0_r1android12-tests-releaseandroid12-security-releaseandroid12-s5-releaseandroid12-s4-releaseandroid12-s3-releaseandroid12-s2-releaseandroid12-s1-releaseandroid12-releaseandroid12-platform-release
Change-Id: I1a20ab2b89a4f0ad6ad0369219ba2a994fe42eb4
Diffstat (limited to 'crosperf/machine_manager.py')
-rw-r--r-- | crosperf/machine_manager.py | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/crosperf/machine_manager.py b/crosperf/machine_manager.py index 0b38eef2..aaf09bf5 100644 --- a/crosperf/machine_manager.py +++ b/crosperf/machine_manager.py @@ -141,7 +141,12 @@ class CrosMachine(object): def _ComputeMachineChecksumString(self): self.checksum_string = '' - exclude_lines_list = ['MHz', 'BogoMIPS', 'bogomips'] + # Some lines from cpuinfo have to be excluded because they are not + # persistent across DUTs. + # MHz, BogoMIPS are dynamically changing values. + # core id, apicid are identifiers assigned on startup + # and may differ on the same type of machine. + exclude_lines_list = ['MHz', 'BogoMIPS', 'bogomips', 'core id', 'apicid'] for line in self.cpuinfo.splitlines(): if not any(e in line for e in exclude_lines_list): self.checksum_string += line @@ -220,8 +225,8 @@ class MachineManager(object): self.logger = lgr or logger.GetLogger() if self.locks_dir and not os.path.isdir(self.locks_dir): - raise MissingLocksDirectory( - 'Cannot access locks directory: %s' % self.locks_dir) + raise MissingLocksDirectory('Cannot access locks directory: %s' % + self.locks_dir) self._initialized_machines = [] self.chromeos_root = chromeos_root @@ -242,8 +247,8 @@ class MachineManager(object): ret, version, _ = self.ce.CrosRunCommandWOutput( cmd, machine=machine.name, chromeos_root=self.chromeos_root) if ret != 0: - raise CrosCommandError( - "Couldn't get Chrome version from %s." % machine.name) + raise CrosCommandError("Couldn't get Chrome version from %s." % + machine.name) if ret != 0: version = '' @@ -312,20 +317,33 @@ class MachineManager(object): # Since this is used for cache lookups before the machines have been # compared/verified, check here to make sure they all have the same # checksum (otherwise the cache lookup may not be valid). - common_checksum = None + base = None for machine in self.GetMachines(label): # Make sure the machine's checksums are calculated. if not machine.machine_checksum: machine.SetUpChecksumInfo() - cs = machine.machine_checksum - # If this is the first machine we've examined, initialize - # common_checksum. - if not common_checksum: - common_checksum = cs + # Use the first machine as the basis for comparison. + if not base: + base = machine # Make sure this machine's checksum matches our 'common' checksum. - if cs != common_checksum: - raise BadChecksum('Machine checksums do not match!') - self.machine_checksum[label.name] = common_checksum + if base.machine_checksum != machine.machine_checksum: + # Found a difference. Fatal error. + # Extract non-matching part and report it. + for mismatch_index in range(len(base.checksum_string)): + if (mismatch_index >= len(machine.checksum_string) or + base.checksum_string[mismatch_index] != + machine.checksum_string[mismatch_index]): + break + # We want to show some context after the mismatch. + end_ind = mismatch_index + 8 + # Print a mismatching string. + raise BadChecksum( + 'Machine checksums do not match!\n' + 'Diff:\n' + f'{base.name}: {base.checksum_string[:end_ind]}\n' + f'{machine.name}: {machine.checksum_string[:end_ind]}\n' + '\nCheck for matching /proc/cpuinfo and /proc/meminfo on DUTs.\n') + self.machine_checksum[label.name] = base.machine_checksum def ComputeCommonCheckSumString(self, label): # The assumption is that this function is only called AFTER @@ -369,8 +387,8 @@ class MachineManager(object): if self.log_level != 'verbose': self.logger.LogOutput('Setting up remote access to %s' % machine_name) - self.logger.LogOutput( - 'Checking machine characteristics for %s' % machine_name) + self.logger.LogOutput('Checking machine characteristics for %s' % + machine_name) cm = CrosMachine(machine_name, self.chromeos_root, self.log_level) if cm.machine_checksum: self._all_machines.append(cm) @@ -410,8 +428,8 @@ class MachineManager(object): if self.acquire_timeout < 0: self.logger.LogFatal('Could not acquire any of the ' - "following machines: '%s'" % ', '.join( - machine.name for machine in machines)) + "following machines: '%s'" % + ', '.join(machine.name for machine in machines)) ### for m in self._machines: @@ -664,8 +682,8 @@ class MockMachineManager(MachineManager): for m in self._all_machines: assert m.name != machine_name, 'Tried to double-add %s' % machine_name cm = MockCrosMachine(machine_name, self.chromeos_root, self.log_level) - assert cm.machine_checksum, ( - 'Could not find checksum for machine %s' % machine_name) + assert cm.machine_checksum, ('Could not find checksum for machine %s' % + machine_name) # In Original MachineManager, the test is 'if cm.machine_checksum:' - if a # machine is unreachable, then its machine_checksum is None. Here we # cannot do this, because machine_checksum is always faked, so we directly |