1""" 2Test if the reproducer correctly detects whether the file system is case sensitive. 3""" 4 5import lldb 6import tempfile 7from lldbsuite.test import lldbtest_config 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10from lldbsuite.test import lldbutil 11 12 13class ReproducerFileSystemSensitivityTestCase(TestBase): 14 NO_DEBUG_INFO_TESTCASE = True 15 16 @skipIfNetBSD 17 @skipIfWindows 18 @skipIfRemote 19 @skipIfiOSSimulator 20 def test_reproducer_attach(self): 21 # The reproducer output path. Note that this is on purpose a lower-case 22 # file name. See the case-sensitivity check below. 23 reproducer = self.getBuildArtifact('test.reproducer') 24 try: 25 shutil.rmtree(reproducer) 26 except OSError: 27 pass 28 # Use Popen because pexpect is overkill and spawnSubprocess is 29 # asynchronous. 30 capture = subprocess.Popen([ 31 lldbtest_config.lldbExec, '-b', '--no-lldbinit', '--no-use-colors'] 32 + sum(map(lambda x: ['-O', x], self.setUpCommands()), []) 33 + ['--capture', '--capture-path', reproducer, 34 '-o', 'reproducer generate' 35 ], 36 stdin=subprocess.PIPE, 37 stdout=subprocess.PIPE, 38 stderr=subprocess.PIPE) 39 outs, _ = capture.communicate() 40 outs = outs.decode('utf-8') 41 self.assertIn('Reproducer written', outs) 42 43 # Read in the YAML file. We only care about a single value, so no 44 # need to parse the full file. 45 with open(os.path.join(reproducer, "files.yaml"), 'r') as file: 46 files_yaml = file.read() 47 48 # Detect the file system case sensitivity by checking if we can 49 # find the reproducer path after converting it to upper case (the 50 # file name is lower case before conversion, so this only works 51 # on case insensitive file systems). 52 case_sensitive = "false" if os.path.exists(reproducer.upper()) else "true" 53 54 self.assertIn("'case-sensitive': '" + case_sensitive + "'", files_yaml) 55