blob: cc5d96172c34417696ea8cc2f0727420f892728b [file] [log] [blame]
Mirko Bonadeib9857482020-12-14 15:28:43 +01001# Copyright (c) 2020 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9import re
10import subprocess
11import sys
12
13WEBRTC_VERSION_RE = re.compile(
14 r'WebRTC source stamp [0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}'
15)
16
17
18if __name__ == '__main__':
19 args = sys.argv
20 if len(args) != 2:
21 print('Usage: binary_version_test.py <FILE_NAME>')
22 exit(1)
23 filename = sys.argv[1]
24 output = subprocess.check_output(['strings', filename])
25 strings_in_binary = output.decode('utf-8').splitlines()
26 for symbol in strings_in_binary:
27 if WEBRTC_VERSION_RE.match(symbol):
28 with open('webrtc_binary_version_check', 'w') as f:
29 f.write(symbol)
30 exit(0)
31 print('WebRTC source timestamp not found in "%s"' % filename)
32 print('Check why "kSourceTimestamp" from call/version.cc is not linked '
33 '(or why it has been optimized away by the compiler/linker)')
34 exit(1)