[PATCH] D127099: [Dexter] Use PurePath to compare paths in Dexter commands

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 08:29:02 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb03451bb9ace: [Dexter] Use PurePath to compare paths in Dexter commands (authored by StephenTozer).

Changed prior to commit:
  https://reviews.llvm.org/D127099?vs=434422&id=435184#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127099/new/

https://reviews.llvm.org/D127099

Files:
  cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexDeclareAddress.py
  cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectWatchBase.py
  cross-project-tests/debuginfo-tests/dexter/dex/dextIR/ProgramState.py


Index: cross-project-tests/debuginfo-tests/dexter/dex/dextIR/ProgramState.py
===================================================================
--- cross-project-tests/debuginfo-tests/dexter/dex/dextIR/ProgramState.py
+++ cross-project-tests/debuginfo-tests/dexter/dex/dextIR/ProgramState.py
@@ -11,6 +11,7 @@
 import os
 
 from collections import OrderedDict
+from pathlib import PurePath
 from typing import List
 
 class SourceLocation:
@@ -31,7 +32,7 @@
         if not other or not isinstance(other, SourceLocation):
             return False
 
-        if self.path and (self.path != other.path):
+        if self.path and (other.path is None or (PurePath(self.path) != PurePath(other.path))):
             return False
 
         if self.lineno and (self.lineno != other.lineno):
Index: cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectWatchBase.py
===================================================================
--- cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectWatchBase.py
+++ cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexExpectWatchBase.py
@@ -14,6 +14,7 @@
 import os
 import math
 from collections import namedtuple
+from pathlib import PurePath
 
 from dex.command.CommandBase import CommandBase, StepExpectInfo
 from dex.command.StepValueInfo import StepValueInfo
@@ -208,12 +209,11 @@
         return differences
 
     def eval(self, step_collection):
-        assert os.path.exists(self.path)
         for step in step_collection.steps:
             loc = step.current_location
 
-            if (loc.path and os.path.exists(loc.path) and
-                os.path.samefile(loc.path, self.path) and
+            if (loc.path and self.path and
+                PurePath(loc.path) == PurePath(self.path) and
                 loc.lineno in self.line_range):
                 try:
                     watch = step.program_state.frames[0].watches[self.expression]
Index: cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexDeclareAddress.py
===================================================================
--- cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexDeclareAddress.py
+++ cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexDeclareAddress.py
@@ -8,6 +8,7 @@
 """
 
 import os
+from pathlib import PurePath
 
 from dex.command.CommandBase import CommandBase, StepExpectInfo
 
@@ -37,13 +38,12 @@
         return self.addr_name
 
     def eval(self, step_collection):
-        assert os.path.exists(self.path)
         self.address_resolutions[self.get_address_name()] = None
         for step in step_collection.steps:
             loc = step.current_location
 
-            if (loc.path and os.path.exists(loc.path) and
-                os.path.samefile(loc.path, self.path) and
+            if (loc.path and self.path and
+                PurePath(loc.path) == PurePath(self.path) and
                 loc.lineno == self.on_line):
                 if self.hit_count > 0:
                     self.hit_count -= 1


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127099.435184.patch
Type: text/x-patch
Size: 3064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220608/295e0018/attachment.bin>


More information about the llvm-commits mailing list