summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2014-11-02 17:26:58 +0100
committerJoel Rosdahl <joel@rosdahl.net>2014-11-02 17:26:58 +0100
commitc6bd92b56f792f4bd7e2df839f75d1f1fc4e4e94 (patch)
tree1986ccbb8acdf380ef4b63e0cf79a7e5a094a2fd
parent0c5724af62f6f0edece88d4c83bb02b54149e26a (diff)
downloadccache-c6bd92b56f792f4bd7e2df839f75d1f1fc4e4e94.tar.gz
Add "read-only direct" setting
-rw-r--r--MANUAL.txt6
-rw-r--r--ccache.c8
-rw-r--r--conf.c5
-rw-r--r--conf.h1
-rw-r--r--confitems.gperf15
-rw-r--r--confitems_lookup.c136
-rw-r--r--envtoconfitems.gperf1
-rw-r--r--envtoconfitems_lookup.c56
-rwxr-xr-xtest.sh31
-rw-r--r--test/test_conf.c7
10 files changed, 164 insertions, 102 deletions
diff --git a/MANUAL.txt b/MANUAL.txt
index a36c5050..dd0c9690 100644
--- a/MANUAL.txt
+++ b/MANUAL.txt
@@ -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
diff --git a/ccache.c b/ccache.c
index e23af937..0b05d1b9 100644
--- 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 ece1f504..56adb484 100644
--- 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 9963bced..0e300285 100644
--- 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;
diff --git a/confitems.gperf b/confitems.gperf
index ae48d2b4..6fb21ef5 100644
--- a/confitems.gperf
+++ b/confitems.gperf
@@ -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)
diff --git a/confitems_lookup.c b/confitems_lookup.c
index d5d1c22a..2642dd66 100644
--- a/confitems_lookup.c
+++ b/confitems_lookup.c
@@ -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;
diff --git a/envtoconfitems.gperf b/envtoconfitems.gperf
index 635bc562..f623c451 100644
--- a/envtoconfitems.gperf
+++ b/envtoconfitems.gperf
@@ -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"
diff --git a/envtoconfitems_lookup.c b/envtoconfitems_lookup.c
index 7f6bea55..2bfd2f82 100644
--- a/envtoconfitems_lookup.c
+++ b/envtoconfitems_lookup.c
@@ -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 da0b2f10..7781497b 100755
--- 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
diff --git a/test/test_conf.c b/test/test_conf.c
index 30bfe432..46be7807 100644
--- a/test/test_conf.c
+++ b/test/test_conf.c
@@ -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,"