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