From: Joel Rosdahl Date: Sat, 25 Mar 2017 15:34:58 +0000 (+0100) Subject: Test that the order of debug options is kept X-Git-Tag: v3.3.5~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3b285f981c18bde0a077c3f36d74fbe3dfdfc7e;p=thirdparty%2Fccache.git Test that the order of debug options is kept --- diff --git a/test/test_argument_processing.c b/test/test_argument_processing.c index 80f23db5c..c5ee96df9 100644 --- a/test/test_argument_processing.c +++ b/test/test_argument_processing.c @@ -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