Correct abspath implementation
realpath doesn't return a path if the file doesn't exist,
but $(abspath) in make does.
Bug: 229132189
Test: ./out/rbcrun ./build/make/tests/run.rbc
Change-Id: Ief7f634024cc52a9e8c5e478666b15512512f0d8
diff --git a/tests/run.rbc b/tests/run.rbc
index 56ba394..454562d 100644
--- a/tests/run.rbc
+++ b/tests/run.rbc
@@ -72,6 +72,14 @@
assert_eq("", rblf.notdir("/"))
assert_eq("", rblf.notdir(""))
+cwd = rblf_shell('pwd')
+assert_eq(cwd+"/foo/bar", rblf.abspath("foo/bar"))
+assert_eq(cwd+"/bar", rblf.abspath("foo/.././bar"))
+assert_eq(cwd+"/bar", rblf.abspath("foo/..////bar//"))
+assert_eq("/foo/baz", rblf.abspath("/foo/bar/../baz"))
+assert_eq(cwd+"/foo/bar "+cwd+"/foo/baz", rblf.abspath("foo/bar foo/baz"))
+assert_eq("/baz", rblf.abspath("/../../../../../../../../../../../../../../../../baz"))
+
assert_eq(
["build/make/tests/board.rbc", "build/make/tests/board_input_vars.rbc"],
rblf.expand_wildcard("build/make/tests/board*.rbc")