]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add "read-only direct" setting
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 2 Nov 2014 16:26:58 +0000 (17:26 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 2 Nov 2014 16:26:58 +0000 (17:26 +0100)
MANUAL.txt
ccache.c
conf.c
conf.h
confitems.gperf
confitems_lookup.c
envtoconfitems.gperf
envtoconfitems_lookup.c
test.sh
test/test_conf.c

index a36c5050387e591ffb1d0e1fa40a43ce5f6c3005..dd0c96908885fbea9a611488564b65aa01e8f372 100644 (file)
@@ -403,6 +403,12 @@ WRAPPERS>>.
     because your ccache directory is read-only, then you need to set
     *temporary_dir* as otherwise ccache will fail to create temporary files.
 
+*read_only_direct* (*CCACHE_READONLY_DIRECT*) [boolean]::
+
+    Just like *read_only* except that ccache will only try to retrieve results
+    from the cache using the direct mode, not the preprocessor mode. See
+    documentation for *read_only* regarding using a read-only ccache directory.
+
 *reache* (*CCACHE_RECACHE*) [boolean]::
 
     If true, ccache will not use any previously stored result. New results will
index e23af937ab24f87520b183a55d3d61f2cc06bf88..0b05d1b9ca35d3128e5570d6c68f3ba555791c00 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -1505,7 +1505,8 @@ from_cache(enum fromcache_call_mode mode, bool put_object_in_manifest)
        if (conf->direct_mode
            && put_object_in_manifest
            && included_files
-           && !conf->read_only) {
+           && !conf->read_only
+           && !conf->read_only_direct) {
                struct stat st;
                size_t old_size = 0; /* in bytes */
                if (stat(manifest_path, &st) == 0) {
@@ -2649,6 +2650,11 @@ ccache(int argc, char *argv[])
                }
        }
 
+       if (conf->read_only_direct) {
+               cc_log("Read-only direct mode; running real compiler");
+               failed();
+       }
+
        /*
         * Find the hash using the preprocessed output. Also updates
         * included_files.
diff --git a/conf.c b/conf.c
index ece1f504d28a1ea63c96d66f1143e5ccd98cb64c..56adb484ecd4079906e50aef03f930c5d98f7b79 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -319,6 +319,7 @@ conf_create(void)
        conf->path = x_strdup("");
        conf->prefix_command = x_strdup("");
        conf->read_only = false;
+       conf->read_only_direct = false;
        conf->recache = false;
        conf->run_second_cpp = false;
        conf->sloppiness = 0;
@@ -583,6 +584,10 @@ conf_print_items(struct conf *conf,
        reformat(&s, "read_only = %s", bool_to_string(conf->read_only));
        printer(s, conf->item_origins[find_conf("read_only")->number], context);
 
+       reformat(&s, "read_only_direct = %s", bool_to_string(conf->read_only_direct));
+       printer(s, conf->item_origins[find_conf("read_only_direct")->number],
+               context);
+
        reformat(&s, "recache = %s", bool_to_string(conf->recache));
        printer(s, conf->item_origins[find_conf("recache")->number], context);
 
diff --git a/conf.h b/conf.h
index 9963bced07487f8e9a81493ad7ca634fbce1c7fb..0e30028542c497e43b20a1cd863e44b67c1575ec 100644 (file)
--- a/conf.h
+++ b/conf.h
@@ -23,6 +23,7 @@ struct conf {
        char *path;
        char *prefix_command;
        bool read_only;
+       bool read_only_direct;
        bool recache;
        bool run_second_cpp;
        unsigned sloppiness;
index ae48d2b4b9724de975eb22fbc03d57182410481e..6fb21ef5c486e17dbf57cda2de95b64c080de952 100644 (file)
@@ -26,10 +26,11 @@ max_size,            15, ITEM(max_size, size)
 path,                16, ITEM(path, env_string)
 prefix_command,      17, ITEM(prefix_command, env_string)
 read_only,           18, ITEM(read_only, bool)
-recache,             19, ITEM(recache, bool)
-run_second_cpp,      20, ITEM(run_second_cpp, bool)
-sloppiness,          21, ITEM(sloppiness, sloppiness)
-stats,               22, ITEM(stats, bool)
-temporary_dir,       23, ITEM(temporary_dir, env_string)
-umask,               24, ITEM(umask, umask)
-unify,               25, ITEM(unify, bool)
+read_only_direct,    19, ITEM(read_only_direct, bool)
+recache,             20, ITEM(recache, bool)
+run_second_cpp,      21, ITEM(run_second_cpp, bool)
+sloppiness,          22, ITEM(sloppiness, sloppiness)
+stats,               23, ITEM(stats, bool)
+temporary_dir,       24, ITEM(temporary_dir, env_string)
+umask,               25, ITEM(umask, umask)
+unify,               26, ITEM(unify, bool)
index d5d1c22a2ee18c527937b779b12549dc912d3668..2642dd66fa2620a8e36e8359ff38df8e2ce9bb2b 100644 (file)
@@ -1,4 +1,4 @@
-/* ANSI-C code produced by gperf version 3.0.3 */
+/* ANSI-C code produced by gperf version 3.0.4 */
 /* Command-line: gperf confitems.gperf  */
 /* Computed positions: -k'1-2' */
 
@@ -31,7 +31,7 @@
 
 #line 8 "confitems.gperf"
 struct conf_item;
-/* maximum key range = 41, duplicates = 0 */
+/* maximum key range = 45, duplicates = 0 */
 
 #ifdef __GNUC__
 __inline
@@ -45,40 +45,39 @@ confitems_hash (register const char *str, register unsigned int len)
 {
   static const unsigned char asso_values[] =
     {
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45,  0, 25,  0,
-      10, 15, 45, 45, 30,  5, 45, 45, 15, 10,
-       0,  0,  0, 45, 10,  0,  0,  5, 45, 45,
-      10, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-      45, 45, 45, 45, 45, 45
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 20,  5,  0,
+      10,  0, 50, 50, 15,  5, 50, 50, 20, 10,
+       0,  0, 10, 50,  0,  0,  0,  5, 50, 50,
+      30, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+      50, 50, 50, 50, 50, 50
     };
   return len + asso_values[(unsigned char)str[1]] + asso_values[(unsigned char)str[0]];
 }
 
-static
 #ifdef __GNUC__
 __inline
-#ifdef __GNUC_STDC_INLINE__
+#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
 __attribute__ ((__gnu_inline__))
 #endif
 #endif
@@ -87,69 +86,76 @@ confitems_get (register const char *str, register unsigned int len)
 {
   enum
     {
-      TOTAL_KEYWORDS = 26,
+      TOTAL_KEYWORDS = 27,
       MIN_WORD_LENGTH = 4,
       MAX_WORD_LENGTH = 19,
-      MIN_HASH_VALUE = 4,
-      MAX_HASH_VALUE = 44
+      MIN_HASH_VALUE = 5,
+      MAX_HASH_VALUE = 49
     };
 
   static const struct conf_item wordlist[] =
     {
       {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL},
       {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL},
-#line 26 "confitems.gperf"
-      {"path",                16, ITEM(path, env_string)},
-#line 32 "confitems.gperf"
-      {"stats",               22, ITEM(stats, bool)},
-      {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL},
+      {"",0,NULL,0,NULL},
+#line 33 "confitems.gperf"
+      {"stats",               23, ITEM(stats, bool)},
+      {"",0,NULL,0,NULL},
+#line 30 "confitems.gperf"
+      {"recache",             20, ITEM(recache, bool)},
 #line 13 "confitems.gperf"
       {"compiler",             3, ITEM(compiler, string)},
-#line 11 "confitems.gperf"
-      {"cache_dir",            1, ITEM(cache_dir, env_string)},
-#line 35 "confitems.gperf"
-      {"unify",               25, ITEM(unify, bool)},
+#line 28 "confitems.gperf"
+      {"read_only",           18, ITEM(read_only, bool)},
+#line 36 "confitems.gperf"
+      {"unify",               26, ITEM(unify, bool)},
 #line 15 "confitems.gperf"
       {"compression",          5, ITEM(compression, bool)},
       {"",0,NULL,0,NULL},
-#line 17 "confitems.gperf"
-      {"cpp_extension",        7, ITEM(cpp_extension, string)},
+#line 34 "confitems.gperf"
+      {"temporary_dir",       24, ITEM(temporary_dir, env_string)},
 #line 14 "confitems.gperf"
       {"compiler_check",       4, ITEM(compiler_check, string)},
       {"",0,NULL,0,NULL},
-#line 12 "confitems.gperf"
-      {"cache_dir_levels",     2, ITEM_V(cache_dir_levels, unsigned, dir_levels)},
+#line 29 "confitems.gperf"
+      {"read_only_direct",    19, ITEM(read_only_direct, bool)},
 #line 16 "confitems.gperf"
       {"compression_level",    6, ITEM(compression_level, unsigned)},
-#line 25 "confitems.gperf"
-      {"max_size",            15, ITEM(max_size, size)},
-#line 24 "confitems.gperf"
-      {"max_files",           14, ITEM(max_files, unsigned)},
-#line 34 "confitems.gperf"
-      {"umask",               24, ITEM(umask, umask)},
+      {"",0,NULL,0,NULL},
+#line 31 "confitems.gperf"
+      {"run_second_cpp",      21, ITEM(run_second_cpp, bool)},
+#line 35 "confitems.gperf"
+      {"umask",               25, ITEM(umask, umask)},
       {"",0,NULL,0,NULL},
 #line 19 "confitems.gperf"
       {"disable",              9, ITEM(disable, bool)},
-#line 23 "confitems.gperf"
-      {"log_file",            13, ITEM(log_file, env_string)},
+#line 17 "confitems.gperf"
+      {"cpp_extension",        7, ITEM(cpp_extension, string)},
 #line 27 "confitems.gperf"
       {"prefix_command",      17, ITEM(prefix_command, env_string)},
-#line 31 "confitems.gperf"
-      {"sloppiness",          21, ITEM(sloppiness, sloppiness)},
+      {"",0,NULL,0,NULL},
 #line 18 "confitems.gperf"
       {"direct_mode",          8, ITEM(direct_mode, bool)},
       {"",0,NULL,0,NULL},
-#line 33 "confitems.gperf"
-      {"temporary_dir",       23, ITEM(temporary_dir, env_string)},
-#line 30 "confitems.gperf"
-      {"run_second_cpp",      20, ITEM(run_second_cpp, bool)},
+#line 23 "confitems.gperf"
+      {"log_file",            13, ITEM(log_file, env_string)},
+#line 11 "confitems.gperf"
+      {"cache_dir",            1, ITEM(cache_dir, env_string)},
+#line 32 "confitems.gperf"
+      {"sloppiness",          22, ITEM(sloppiness, sloppiness)},
       {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL},
-#line 29 "confitems.gperf"
-      {"recache",             19, ITEM(recache, bool)},
 #line 10 "confitems.gperf"
       {"base_dir",             0, ITEM_V(base_dir, env_string, absolute_path)},
-#line 28 "confitems.gperf"
-      {"read_only",           18, ITEM(read_only, bool)},
+#line 26 "confitems.gperf"
+      {"path",                16, ITEM(path, env_string)},
+      {"",0,NULL,0,NULL},
+#line 12 "confitems.gperf"
+      {"cache_dir_levels",     2, ITEM_V(cache_dir_levels, unsigned, dir_levels)},
+      {"",0,NULL,0,NULL},
+#line 25 "confitems.gperf"
+      {"max_size",            15, ITEM(max_size, size)},
+#line 24 "confitems.gperf"
+      {"max_files",           14, ITEM(max_files, unsigned)},
       {"",0,NULL,0,NULL}, {"",0,NULL,0,NULL},
       {"",0,NULL,0,NULL},
 #line 22 "confitems.gperf"
@@ -176,4 +182,4 @@ confitems_get (register const char *str, register unsigned int len)
     }
   return 0;
 }
-static const size_t CONFITEMS_TOTAL_KEYWORDS = 26;
+static const size_t CONFITEMS_TOTAL_KEYWORDS = 27;
index 635bc562d79a7e8e595fbb14ca1bf2e3aa354bf1..f623c4512b9a789498a984b75a249fcf6cdf00bb 100644 (file)
@@ -28,6 +28,7 @@ NLEVELS, "cache_dir_levels"
 PATH, "path"
 PREFIX, "prefix_command"
 READONLY, "read_only"
+READONLY_DIRECT, "read_only_direct"
 RECACHE, "recache"
 SLOPPINESS, "sloppiness"
 STATS, "stats"
index 7f6bea556dd9ba46c82d8ffdd2855159fbdc6311..2bfd2f820646e870c64e0786d28f540da836f9c5 100644 (file)
@@ -1,4 +1,4 @@
-/* ANSI-C code produced by gperf version 3.0.3 */
+/* ANSI-C code produced by gperf version 3.0.4 */
 /* Command-line: gperf envtoconfitems.gperf  */
 /* Computed positions: -k'1,5' */
 
@@ -51,10 +51,10 @@ envtoconfitems_hash (register const char *str, register unsigned int len)
       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
-      43, 43, 43, 43, 43, 43,  5,  0,  0, 10,
-      20, 43, 15, 43, 10, 43, 20, 10, 15,  0,
-       5,  5,  5,  0,  0,  5, 43, 43, 43, 43,
-       0, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+      43, 43, 43, 43, 43, 43, 20,  0,  0, 10,
+      20, 43, 15, 43, 10, 43,  5, 10, 15,  0,
+       5, 10,  5,  0,  0,  0, 43, 43, 43, 43,
+      10, 43, 43, 43, 43, 43, 43, 43, 43, 43,
       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
       43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
@@ -89,10 +89,9 @@ envtoconfitems_hash (register const char *str, register unsigned int len)
   return hval;
 }
 
-static
 #ifdef __GNUC__
 __inline
-#ifdef __GNUC_STDC_INLINE__
+#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
 __attribute__ ((__gnu_inline__))
 #endif
 #endif
@@ -101,9 +100,9 @@ envtoconfitems_get (register const char *str, register unsigned int len)
 {
   enum
     {
-      TOTAL_KEYWORDS = 26,
+      TOTAL_KEYWORDS = 27,
       MIN_WORD_LENGTH = 2,
-      MAX_WORD_LENGTH = 13,
+      MAX_WORD_LENGTH = 15,
       MIN_HASH_VALUE = 2,
       MAX_HASH_VALUE = 42
     };
@@ -117,7 +116,7 @@ envtoconfitems_get (register const char *str, register unsigned int len)
       {"DIR", "cache_dir"},
 #line 16 "envtoconfitems.gperf"
       {"CPP2", "run_second_cpp"},
-#line 33 "envtoconfitems.gperf"
+#line 34 "envtoconfitems.gperf"
       {"STATS", "stats"},
 #line 18 "envtoconfitems.gperf"
       {"DIRECT", "direct_mode"},
@@ -128,49 +127,50 @@ envtoconfitems_get (register const char *str, register unsigned int len)
 #line 28 "envtoconfitems.gperf"
       {"PATH", "path"},
 #line 36 "envtoconfitems.gperf"
-      {"UNIFY", "unify"},
+      {"UMASK", "umask"},
       {"",""},
-#line 31 "envtoconfitems.gperf"
+#line 32 "envtoconfitems.gperf"
       {"RECACHE", "recache"},
 #line 15 "envtoconfitems.gperf"
       {"COMPRESSLEVEL", "compression_level"},
       {"",""},
-#line 32 "envtoconfitems.gperf"
-      {"SLOPPINESS", "sloppiness"},
+#line 37 "envtoconfitems.gperf"
+      {"UNIFY", "unify"},
       {"",""},
-#line 34 "envtoconfitems.gperf"
+#line 35 "envtoconfitems.gperf"
       {"TEMPDIR", "temporary_dir"},
 #line 30 "envtoconfitems.gperf"
       {"READONLY", "read_only"},
 #line 20 "envtoconfitems.gperf"
       {"EXTENSION", "cpp_extension"},
-      {"",""},
+#line 33 "envtoconfitems.gperf"
+      {"SLOPPINESS", "sloppiness"},
 #line 29 "envtoconfitems.gperf"
       {"PREFIX", "prefix_command"},
-#line 11 "envtoconfitems.gperf"
-      {"BASEDIR", "base_dir"},
+#line 24 "envtoconfitems.gperf"
+      {"LOGFILE", "log_file"},
 #line 13 "envtoconfitems.gperf"
       {"COMPILERCHECK", "compiler_check"},
       {"",""},
-#line 21 "envtoconfitems.gperf"
-      {"EXTRAFILES", "extra_files_to_hash"},
+#line 31 "envtoconfitems.gperf"
+      {"READONLY_DIRECT", "read_only_direct"},
       {"",""},
 #line 26 "envtoconfitems.gperf"
       {"MAXSIZE", "max_size"},
 #line 25 "envtoconfitems.gperf"
       {"MAXFILES", "max_files"},
-      {"",""},
-#line 35 "envtoconfitems.gperf"
-      {"UMASK", "umask"},
-      {"",""},
+      {"",""}, {"",""}, {"",""},
 #line 23 "envtoconfitems.gperf"
       {"HASHDIR", "hash_dir"},
 #line 22 "envtoconfitems.gperf"
       {"HARDLINK", "hard_link"},
       {"",""}, {"",""}, {"",""},
-#line 24 "envtoconfitems.gperf"
-      {"LOGFILE", "log_file"},
-      {"",""}, {"",""}, {"",""}, {"",""},
+#line 11 "envtoconfitems.gperf"
+      {"BASEDIR", "base_dir"},
+      {"",""}, {"",""},
+#line 21 "envtoconfitems.gperf"
+      {"EXTRAFILES", "extra_files_to_hash"},
+      {"",""},
 #line 27 "envtoconfitems.gperf"
       {"NLEVELS", "cache_dir_levels"}
     };
@@ -189,4 +189,4 @@ envtoconfitems_get (register const char *str, register unsigned int len)
     }
   return 0;
 }
-static const size_t ENVTOCONFITEMS_TOTAL_KEYWORDS = 26;
+static const size_t ENVTOCONFITEMS_TOTAL_KEYWORDS = 27;
diff --git a/test.sh b/test.sh
index da0b2f108891ac34f5ac3f69148b48c8dc782921..7781497b6b8adfe9bdda6d6915609e065f47d648 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -37,6 +37,7 @@ unset CCACHE_NOSTATS
 unset CCACHE_PATH
 unset CCACHE_PREFIX
 unset CCACHE_READONLY
+unset CCACHE_READONLY_DIRECT
 unset CCACHE_RECACHE
 unset CCACHE_SLOPPINESS
 unset CCACHE_TEMPDIR
@@ -1648,6 +1649,35 @@ readonly_suite() {
     ##################################################################
 }
 
+readonly_direct_suite() {
+    unset CCACHE_NODIRECT
+
+    ##################################################################
+    # Create some code to compile.
+    echo "int test;" >test.c
+
+    # Cache a compilation.
+    testname="fill cache"
+    $CCACHE $COMPILER -c test.c -o test.o
+    checkstat 'cache hit (direct)' 0
+    checkstat 'cache hit (preprocessed)' 0
+    checkstat 'cache miss' 1
+
+    # Check that "readonly direct" mode gets a direct hit.
+    testname="direct hit"
+    CCACHE_READONLY_DIRECT=1 $CCACHE $COMPILER -c test.c -o test.o
+    checkstat 'cache hit (direct)' 1
+    checkstat 'cache hit (preprocessed)' 0
+    checkstat 'cache miss' 1
+
+    # Check that "readonly direct" mode doesn't get a preprocessed hit.
+    testname="preprocessed miss"
+    CCACHE_READONLY_DIRECT=1 $CCACHE $COMPILER -DFOO -c test.c -o test.o
+    checkstat 'cache hit (direct)' 1
+    checkstat 'cache hit (preprocessed)' 0
+    checkstat 'cache miss' 1
+}
+
 extrafiles_suite() {
     ##################################################################
     # Create some code to compile.
@@ -2388,6 +2418,7 @@ basedir       !win32
 direct
 compression
 readonly
+readonly_direct
 extrafiles
 cleanup
 pch
index 30bfe432837bc10c30702aa743625ccabacfccd0..46be7807a5c9bcfa3fc0a5c5da60a4464b203f26 100644 (file)
@@ -20,7 +20,7 @@
 #include "test/framework.h"
 #include "test/util.h"
 
-#define N_CONFIG_ITEMS 26
+#define N_CONFIG_ITEMS 27
 static struct {
        char *descr;
        const char *origin;
@@ -70,6 +70,7 @@ TEST(conf_create)
        CHECK_STR_EQ("", conf->path);
        CHECK_STR_EQ("", conf->prefix_command);
        CHECK(!conf->read_only);
+       CHECK(!conf->read_only_direct);
        CHECK(!conf->recache);
        CHECK(!conf->run_second_cpp);
        CHECK_INT_EQ(0, conf->sloppiness);
@@ -112,6 +113,7 @@ TEST(conf_read_valid_config)
                "path = $USER.x\n"
                "prefix_command = x$USER\n"
                "read_only = true\n"
+               "read_only_direct = true\n"
                "recache = true\n"
                "run_second_cpp = true\n"
                "sloppiness =     file_macro   ,time_macros,  include_file_mtime,include_file_ctime,file_stat_matches  pch_defines  \n"
@@ -141,6 +143,7 @@ TEST(conf_read_valid_config)
        CHECK_STR_EQ_FREE1(format("%s.x", user), conf->path);
        CHECK_STR_EQ_FREE1(format("x%s", user), conf->prefix_command);
        CHECK(conf->read_only);
+       CHECK(conf->read_only_direct);
        CHECK(conf->recache);
        CHECK(conf->run_second_cpp);
        CHECK_INT_EQ(SLOPPY_INCLUDE_FILE_MTIME|SLOPPY_INCLUDE_FILE_CTIME|
@@ -361,6 +364,7 @@ TEST(conf_print_items)
                true,
                true,
                true,
+               true,
                SLOPPY_FILE_MACRO|SLOPPY_INCLUDE_FILE_MTIME|
                  SLOPPY_INCLUDE_FILE_CTIME|SLOPPY_TIME_MACROS|
                  SLOPPY_FILE_STAT_MATCHES,
@@ -398,6 +402,7 @@ TEST(conf_print_items)
        CHECK_STR_EQ("path = p", received_conf_items[n++].descr);
        CHECK_STR_EQ("prefix_command = pc", received_conf_items[n++].descr);
        CHECK_STR_EQ("read_only = true", received_conf_items[n++].descr);
+       CHECK_STR_EQ("read_only_direct = true", received_conf_items[n++].descr);
        CHECK_STR_EQ("recache = true", received_conf_items[n++].descr);
        CHECK_STR_EQ("run_second_cpp = true", received_conf_items[n++].descr);
        CHECK_STR_EQ("sloppiness = file_macro, include_file_mtime,"