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