1#!/usr/bin/env python3 2# Copyright 2017 the V8 project authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6# for py2/py3 compatibility 7from __future__ import print_function 8 9import sys 10 11assert len(sys.argv) == 3 12 13if sys.argv[1] == 'equal': 14 # 1. Scenario: print equal allocation hashes. 15 print('### Allocations = 9497, hash = 0xc322c6b0') 16elif sys.argv[1] == 'differ': 17 # 2. Scenario: print different allocation hashes. This prints a different 18 # hash on the second run, based on the content of a semaphore file. This 19 # file is expected to be empty in the beginning. 20 with open(sys.argv[2]) as f: 21 if f.read(): 22 print('### Allocations = 9497, hash = 0xc322c6b0') 23 else: 24 print('### Allocations = 9497, hash = 0xc322c6b1') 25 with open(sys.argv[2], 'w') as f: 26 f.write('something') 27else: 28 # 3. Scenario: missing allocation hashes. Don't print anything. 29 assert 'missing' 30 31sys.exit(0) 32