]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Test that the order of debug options is kept
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 25 Mar 2017 15:34:58 +0000 (16:34 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 25 Mar 2017 15:34:58 +0000 (16:34 +0100)
test/test_argument_processing.c

index 80f23db5c0520cd5b8fe5288365261697515aac3..c5ee96df9c94c442f25d1bda54bb5b1a4e92aec5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2016 Joel Rosdahl
+// Copyright (C) 2010-2017 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
@@ -438,4 +438,36 @@ TEST(I_flag_with_concat_arg_should_be_rewritten_if_basedir_is_used)
        args_free(act_cc);
 }
 
+TEST(debug_flag_order_with_known_option_first)
+{
+       struct args *orig = args_init_from_string("cc -g1 -gsplit-dwarf foo.c -c");
+       struct args *exp_cpp = args_init_from_string("cc -g1 -gsplit-dwarf");
+       struct args *exp_cc = args_init_from_string("cc -g1 -gsplit-dwarf -c");
+       struct args *act_cpp = NULL;
+       struct args *act_cc = NULL;
+
+       create_file("foo.c", "");
+       CHECK(cc_process_args(orig, &act_cpp, &act_cc));
+       CHECK_ARGS_EQ_FREE12(exp_cpp, act_cpp);
+       CHECK_ARGS_EQ_FREE12(exp_cc, act_cc);
+
+       args_free(orig);
+}
+
+TEST(debug_flag_order_with_known_option_last)
+{
+       struct args *orig = args_init_from_string("cc -gsplit-dwarf -g1 foo.c -c");
+       struct args *exp_cpp = args_init_from_string("cc -gsplit-dwarf -g1");
+       struct args *exp_cc = args_init_from_string("cc -gsplit-dwarf -g1 -c");
+       struct args *act_cpp = NULL;
+       struct args *act_cc = NULL;
+
+       create_file("foo.c", "");
+       CHECK(cc_process_args(orig, &act_cpp, &act_cc));
+       CHECK_ARGS_EQ_FREE12(exp_cpp, act_cpp);
+       CHECK_ARGS_EQ_FREE12(exp_cc, act_cc);
+
+       args_free(orig);
+}
+
 TEST_SUITE_END