From 99e9d1190283b4f65d682451ff9dfb2c6140bc39 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Fri, 11 Sep 2015 14:10:04 -0100 Subject: [PATCH] [Test] Fix handling of symbolic links in tests Summary: Some tests were failing when infer repo was in fact symbolic link. Fix it by resolving symbolic links when comparing results --- infer/tests/utils/InferError.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/infer/tests/utils/InferError.java b/infer/tests/utils/InferError.java index 77c3080ee..0afb09647 100644 --- a/infer/tests/utils/InferError.java +++ b/infer/tests/utils/InferError.java @@ -10,6 +10,7 @@ package utils; import java.nio.file.Path; +import java.io.IOException; public class InferError { @@ -22,7 +23,11 @@ public class InferError { this.errorType = errorType; this.errorMethod = errorMethod; this.errorLine = errorLine; - this.errorFile = errorFile; + try { + this.errorFile = errorFile.toRealPath(); + } catch (IOException e) { + this.errorFile = errorFile; + } } public InferError(String errorType, Path errorFile, String errorMethod) { @@ -75,7 +80,13 @@ public class InferError { } public boolean matchFile(Path file) { - return this.errorFile.equals(file); + Path realFile; + try { + realFile = file.toRealPath(); + } catch (IOException e) { + realFile = file; + } + return this.errorFile.equals(realFile); } public boolean matchMethod(String method) {