summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2013-08-08 18:06:16 +0200
committerJoel Rosdahl <joel@rosdahl.net>2013-08-08 18:06:16 +0200
commita9dc850d06ecb6aa3b15c4afaadc4cc0300d794a (patch)
tree29a0bbebdf5099bc1d092e6fb8cbbf331fe7a5c9 /test
parentd3eef28469d49f514a0b6e32888c85840a2b8d8f (diff)
downloadccache-a9dc850d06ecb6aa3b15c4afaadc4cc0300d794a.tar.gz
Fix path canonicalization in make_relative_path when path doesn't exist
Diffstat (limited to 'test')
-rw-r--r--test/test_argument_processing.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/test/test_argument_processing.c b/test/test_argument_processing.c
index 94e46f4f..6ed0daa8 100644
--- a/test/test_argument_processing.c
+++ b/test/test_argument_processing.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2012 Joel Rosdahl
+ * Copyright (C) 2010-2013 Joel Rosdahl
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -90,20 +90,19 @@ TEST(sysroot_should_be_rewritten_if_basedir_is_used)
{
extern char *base_dir;
extern char *current_working_dir;
- struct args *orig =
- args_init_from_string("cc --sysroot=/some/directory -c foo.c");
+ char *arg_string;
+ struct args *orig;
struct args *act_cpp = NULL, *act_cc = NULL;
- create_file("foo.c", "");
-
- CHECK(cc_process_args(orig, &act_cpp, &act_cc));
- CHECK_STR_EQ(act_cpp->argv[1], "--sysroot=/some/directory");
- cc_reset();
- base_dir = "/some";
+ create_file("foo.c", "");
current_working_dir = get_cwd();
+ arg_string = format("cc --sysroot=%s/foo -c foo.c", current_working_dir);
+ orig = args_init_from_string(arg_string);
+
+ base_dir = "/";
CHECK(cc_process_args(orig, &act_cpp, &act_cc));
- CHECK(str_startswith(act_cpp->argv[1], "--sysroot=../"));
+ CHECK(str_startswith(act_cpp->argv[1], "--sysroot=./foo"));
args_free(orig);
base_dir = NULL;