From 2ea3309942f17e7f9ff12389353ddd1dfa4fcb4c Mon Sep 17 00:00:00 2001 From: John Johansen Date: Sun, 7 Jan 2018 01:06:10 -0800 Subject: [PATCH] parser: add support for conditional includes This is a minimal patch to add conditional includes to the profile language. The syntax for conditional includes is similar to regular includes except with the addition of "if exists" after "include" include if exists include if exists "foo/bar" include if exists "/foo/bar" include if exists foo/bar Note: The patch is designed to be backportable with minimum effort. Cleanups and code refactoring are planned for follow up patches that won't be back ported. Signed-off-by: John Johansen --- parser/apparmor.d.pod | 8 ++- parser/parser_lex.l | 54 ++++++++++++++++--- .../simple_tests/bare_include_tests/ok_61.sd | 7 +++ .../simple_tests/bare_include_tests/ok_62.sd | 7 +++ .../simple_tests/bare_include_tests/ok_63.sd | 7 +++ .../simple_tests/bare_include_tests/ok_64.sd | 8 +++ .../simple_tests/bare_include_tests/ok_65.sd | 9 ++++ .../simple_tests/bare_include_tests/ok_66.sd | 7 +++ .../simple_tests/bare_include_tests/ok_67.sd | 7 +++ .../simple_tests/bare_include_tests/ok_68.sd | 7 +++ .../simple_tests/bare_include_tests/ok_69.sd | 8 +++ .../simple_tests/bare_include_tests/ok_70.sd | 9 ++++ .../simple_tests/bare_include_tests/ok_76.sd | 7 +++ .../simple_tests/bare_include_tests/ok_77.sd | 7 +++ .../simple_tests/bare_include_tests/ok_78.sd | 7 +++ .../simple_tests/bare_include_tests/ok_79.sd | 7 +++ .../simple_tests/bare_include_tests/ok_80.sd | 7 +++ .../simple_tests/bare_include_tests/ok_81.sd | 7 +++ .../simple_tests/bare_include_tests/ok_82.sd | 7 +++ .../simple_tests/bare_include_tests/ok_83.sd | 7 +++ .../simple_tests/bare_include_tests/ok_84.sd | 8 +++ .../simple_tests/bare_include_tests/ok_85.sd | 8 +++ .../simple_tests/bare_include_tests/ok_86.sd | 7 +++ .../simple_tests/bare_include_tests/ok_87.sd | 7 +++ .../simple_tests/bare_include_tests/ok_88.sd | 8 +++ .../tst/simple_tests/include_tests/ok_61.sd | 7 +++ .../tst/simple_tests/include_tests/ok_62.sd | 7 +++ .../tst/simple_tests/include_tests/ok_63.sd | 7 +++ .../tst/simple_tests/include_tests/ok_64.sd | 8 +++ .../tst/simple_tests/include_tests/ok_65.sd | 9 ++++ .../tst/simple_tests/include_tests/ok_66.sd | 7 +++ .../tst/simple_tests/include_tests/ok_67.sd | 7 +++ .../tst/simple_tests/include_tests/ok_68.sd | 7 +++ .../tst/simple_tests/include_tests/ok_69.sd | 8 +++ .../tst/simple_tests/include_tests/ok_70.sd | 9 ++++ .../tst/simple_tests/include_tests/ok_76.sd | 7 +++ .../tst/simple_tests/include_tests/ok_77.sd | 7 +++ .../tst/simple_tests/include_tests/ok_78.sd | 7 +++ .../tst/simple_tests/include_tests/ok_79.sd | 7 +++ .../tst/simple_tests/include_tests/ok_80.sd | 7 +++ .../tst/simple_tests/include_tests/ok_81.sd | 7 +++ .../tst/simple_tests/include_tests/ok_82.sd | 7 +++ .../tst/simple_tests/include_tests/ok_83.sd | 7 +++ .../tst/simple_tests/include_tests/ok_84.sd | 8 +++ .../tst/simple_tests/include_tests/ok_85.sd | 8 +++ .../tst/simple_tests/include_tests/ok_86.sd | 7 +++ .../tst/simple_tests/include_tests/ok_87.sd | 7 +++ .../tst/simple_tests/include_tests/ok_88.sd | 8 +++ 48 files changed, 392 insertions(+), 10 deletions(-) create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_61.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_62.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_63.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_64.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_65.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_66.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_67.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_68.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_69.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_70.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_76.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_77.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_78.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_79.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_80.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_81.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_82.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_83.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_84.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_85.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_86.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_87.sd create mode 100644 parser/tst/simple_tests/bare_include_tests/ok_88.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_61.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_62.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_63.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_64.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_65.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_66.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_67.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_68.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_69.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_70.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_76.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_77.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_78.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_79.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_80.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_81.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_82.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_83.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_84.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_85.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_86.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_87.sd create mode 100644 parser/tst/simple_tests/include_tests/ok_88.sd diff --git a/parser/apparmor.d.pod b/parser/apparmor.d.pod index 1944e9224..9baf8a249 100644 --- a/parser/apparmor.d.pod +++ b/parser/apparmor.d.pod @@ -55,7 +55,7 @@ B = '@{' I [ ( I | '_' ) ... ] '}' B = 'alias' I '-E' I ',' -B = '#include' ( I | I ) +B = ( '#include' | 'include' ) [ 'if exists' ] ( I | I ) B = '"' path '"' (the path is passed to open(2)) @@ -1414,13 +1414,17 @@ rules into a rule block. =head2 #include mechanism -AppArmor provides an easy abstraction mechanism to group common file +AppArmor provides an easy abstraction mechanism to group common access requirements; this abstraction is an extremely flexible way to grant site-specific rights and makes writing new AppArmor profiles very simple by assembling the needed building blocks for any given program. The use of '#include' is modelled directly after cpp(1); its use will replace the '#include' statement with the specified file's contents. +The leading '#' is optional, and the '#include' keyword can be followed +by an option conditional 'if exists' that specifies profile compilation +should continue if the specified file or directory is not found. + B<#include "/absolute/path"> specifies that F should be used. B<#include "relative/path"> specifies that F should be used, where the path is relative to the current working directory. diff --git a/parser/parser_lex.l b/parser/parser_lex.l index a39d8d8c3..3240d7a10 100644 --- a/parser/parser_lex.l +++ b/parser/parser_lex.l @@ -144,7 +144,7 @@ static int include_dir_cb(int dirfd unused, const char *name, struct stat *st, return 0; } -void include_filename(char *filename, int search) +void include_filename(char *filename, int search, bool if_exists) { FILE *include_file = NULL; struct stat my_stat; @@ -161,11 +161,14 @@ void include_filename(char *filename, int search) include_file = fopen(fullpath, "r"); } - if (!include_file) + if (!include_file) { + if (if_exists) + return; yyerror(_("Could not open '%s'"), fullpath ? fullpath: filename); + } - if (fstat(fileno(include_file), &my_stat)) + if (fstat(fileno(include_file), &my_stat)) yyerror(_("fstat failed for '%s'"), fullpath); if (S_ISREG(my_stat.st_mode)) { @@ -257,6 +260,7 @@ LT_EQUAL <= %x UNIX_MODE %x CHANGE_PROFILE_MODE %x INCLUDE +%x INCLUDE_EXISTS %% @@ -269,25 +273,44 @@ LT_EQUAL <= } %} -{ +{ {WS}+ { DUMP_PREPROCESS; /* Ignoring whitespace */ } } -{ +{ (\<([^"\>\t\r\n]+)\>|{QUOTED_ID}) { /* | "filename" */ autofree char *filename = strndup(yytext, yyleng - 1); - include_filename(filename + 1, *filename == '<'); + include_filename(filename + 1, *filename == '<', true); POP_NODUMP(); } (\<{QUOTED_ID}\>) { /* <"filename"> */ autofree char *filename = strndup(yytext, yyleng - 2); - include_filename(filename + 2, true); + include_filename(filename + 2, true, true); POP_NODUMP(); } ({IDS}|{QUOTED_ID}) { /* filename */ - include_filename(yytext, 0); + include_filename(yytext, 0, true); + POP_NODUMP(); + } +} + +{ + (\<([^"\>\t\r\n]+)\>|{QUOTED_ID}) { /* | "filename" */ + autofree char *filename = strndup(yytext, yyleng - 1); + include_filename(filename + 1, *filename == '<', false); + POP_NODUMP(); + } + + (\<{QUOTED_ID}\>) { /* <"filename"> */ + autofree char *filename = strndup(yytext, yyleng - 2); + include_filename(filename + 2, true, false); + POP_NODUMP(); + } + + ({IDS}|{QUOTED_ID}) { /* filename */ + include_filename(yytext, 0, false); POP_NODUMP(); } } @@ -533,6 +556,20 @@ LT_EQUAL <= } } +#include{WS}+if{WS}+exists/{WS}.*\r?\n { + /* Don't use PUSH() macro here as we don't want #include echoed out. + * It needs to be handled specially + */ + yy_push_state(INCLUDE_EXISTS); +} + +include{WS}+if{WS}+exists/{WS} { + /* Don't use PUSH() macro here as we don't want #include echoed out. + * It needs to be handled specially + */ + yy_push_state(INCLUDE_EXISTS); +} + #include/.*\r?\n { /* Don't use PUSH() macro here as we don't want #include echoed out. * It needs to be handled specially @@ -681,4 +718,5 @@ unordered_map state_names = { STATE_TABLE_ENT(UNIX_MODE), STATE_TABLE_ENT(CHANGE_PROFILE_MODE), STATE_TABLE_ENT(INCLUDE), + STATE_TABLE_ENT(INCLUDE_EXISTS), }; diff --git a/parser/tst/simple_tests/bare_include_tests/ok_61.sd b/parser/tst/simple_tests/bare_include_tests/ok_61.sd new file mode 100644 index 000000000..c62880741 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_61.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + include if exists "simple_tests/include_tests/includes_okay_helper.include" +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_62.sd b/parser/tst/simple_tests/bare_include_tests/ok_62.sd new file mode 100644 index 000000000..c33eb2bdf --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_62.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + include if exists "../tst/simple_tests/include_tests/includes_okay_helper.include" +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_63.sd b/parser/tst/simple_tests/bare_include_tests/ok_63.sd new file mode 100644 index 000000000..22e974dfd --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_63.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + include if exists "./simple_tests/include_tests/includes_okay_helper.include" +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_64.sd b/parser/tst/simple_tests/bare_include_tests/ok_64.sd new file mode 100644 index 000000000..922019641 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_64.sd @@ -0,0 +1,8 @@ +# +#=DESCRIPTION include if existss testing - test some "odd" locations of include if existss +#=EXRESULT PASS +# +/does/not/exist { + /does/not/exist mr, include if exists /bin/true Px, + include if exists "../tst/simple_tests/include_tests/includes_okay_helper.include" include if exists +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_65.sd b/parser/tst/simple_tests/bare_include_tests/ok_65.sd new file mode 100644 index 000000000..8309c36d1 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_65.sd @@ -0,0 +1,9 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of a directory +#=EXRESULT PASS +# +/does/not/exist { + include if exists + include if exists "simple_tests/includes/" + include if exists +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_66.sd b/parser/tst/simple_tests/bare_include_tests/ok_66.sd new file mode 100644 index 000000000..c990a1041 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_66.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + include if exists simple_tests/include_tests/includes_okay_helper.include +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_67.sd b/parser/tst/simple_tests/bare_include_tests/ok_67.sd new file mode 100644 index 000000000..b04f08d88 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_67.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + include if exists ../tst/simple_tests/include_tests/includes_okay_helper.include +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_68.sd b/parser/tst/simple_tests/bare_include_tests/ok_68.sd new file mode 100644 index 000000000..261c1e493 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_68.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + include if exists ./simple_tests/include_tests/includes_okay_helper.include +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_69.sd b/parser/tst/simple_tests/bare_include_tests/ok_69.sd new file mode 100644 index 000000000..e6b75fb42 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_69.sd @@ -0,0 +1,8 @@ +# +#=DESCRIPTION include if existss testing - test some "odd" locations of include if existss +#=EXRESULT PASS +# +/does/not/exist { + /does/not/exist mr, include if exists /bin/true Px, + include if exists ../tst/simple_tests/include_tests/includes_okay_helper.include include if exists +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_70.sd b/parser/tst/simple_tests/bare_include_tests/ok_70.sd new file mode 100644 index 000000000..65c5e4f35 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_70.sd @@ -0,0 +1,9 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of a directory +#=EXRESULT PASS +# +/does/not/exist { + include if exists + include if exists simple_tests/includes/ + include if exists +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_76.sd b/parser/tst/simple_tests/bare_include_tests/ok_76.sd new file mode 100644 index 000000000..47e064cfa --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_76.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + include if exists "simple_tests/include_tests/includes with space helper.include" +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_77.sd b/parser/tst/simple_tests/bare_include_tests/ok_77.sd new file mode 100644 index 000000000..7034d1272 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_77.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + include if exists "simple_tests/include_tests/includes with space helper.include" #comment +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_78.sd b/parser/tst/simple_tests/bare_include_tests/ok_78.sd new file mode 100644 index 000000000..a119e0f39 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_78.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + include if exists <"include_tests/includes with space helper.include"> +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_79.sd b/parser/tst/simple_tests/bare_include_tests/ok_79.sd new file mode 100644 index 000000000..ca3149825 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_79.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + include if exists <"include_tests/includes with space helper.include"> #comment +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_80.sd b/parser/tst/simple_tests/bare_include_tests/ok_80.sd new file mode 100644 index 000000000..ebb8d180e --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_80.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + include if exists +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_81.sd b/parser/tst/simple_tests/bare_include_tests/ok_81.sd new file mode 100644 index 000000000..7b68ce5a4 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_81.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + include if exists #comment +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_82.sd b/parser/tst/simple_tests/bare_include_tests/ok_82.sd new file mode 100644 index 000000000..e2a13f9b6 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_82.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if exist testing - non-existent include should pass +#=EXRESULT PASS +# +/does/not/exist { + include if exists "does-not-exist/does-not-exist" +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_83.sd b/parser/tst/simple_tests/bare_include_tests/ok_83.sd new file mode 100644 index 000000000..a78d02833 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_83.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if exists testing - abs path include does not exist should pass +#=EXRESULT PASS +# +/does/not/exist { + include if exists "/does-not-exist/does-not-exist" +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_84.sd b/parser/tst/simple_tests/bare_include_tests/ok_84.sd new file mode 100644 index 000000000..52ca0a5a5 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_84.sd @@ -0,0 +1,8 @@ +# +#=DESCRIPTION include if exists testing - non-existent include should pass +#=EXRESULT PASS +# +/does/not/exist { + include + include if exists "../does-not-exist/does-not-exist" +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_85.sd b/parser/tst/simple_tests/bare_include_tests/ok_85.sd new file mode 100644 index 000000000..52ca0a5a5 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_85.sd @@ -0,0 +1,8 @@ +# +#=DESCRIPTION include if exists testing - non-existent include should pass +#=EXRESULT PASS +# +/does/not/exist { + include + include if exists "../does-not-exist/does-not-exist" +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_86.sd b/parser/tst/simple_tests/bare_include_tests/ok_86.sd new file mode 100644 index 000000000..a66bbad1e --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_86.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if exists testing - non-existent include should pass +#=EXRESULT PASS +# +/does/not/exist { + include if exists "does-not-exist/does-not-exist" +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_87.sd b/parser/tst/simple_tests/bare_include_tests/ok_87.sd new file mode 100644 index 000000000..d09662af3 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_87.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if exists testing - non-existent include should pass +#=EXRESULT PASS +# +/does/not/exist { + include if exists +} diff --git a/parser/tst/simple_tests/bare_include_tests/ok_88.sd b/parser/tst/simple_tests/bare_include_tests/ok_88.sd new file mode 100644 index 000000000..8600413f4 --- /dev/null +++ b/parser/tst/simple_tests/bare_include_tests/ok_88.sd @@ -0,0 +1,8 @@ +# +#=DESCRIPTION include if exists testing - non-existent include should pass +#=EXRESULT PASS +# +/does/not/exist { + include if exists + include +} diff --git a/parser/tst/simple_tests/include_tests/ok_61.sd b/parser/tst/simple_tests/include_tests/ok_61.sd new file mode 100644 index 000000000..8e46f4bcf --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_61.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + #include if exists "simple_tests/include_tests/includes_okay_helper.include" +} diff --git a/parser/tst/simple_tests/include_tests/ok_62.sd b/parser/tst/simple_tests/include_tests/ok_62.sd new file mode 100644 index 000000000..248cef0bf --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_62.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + #include if exists "../tst/simple_tests/include_tests/includes_okay_helper.include" +} diff --git a/parser/tst/simple_tests/include_tests/ok_63.sd b/parser/tst/simple_tests/include_tests/ok_63.sd new file mode 100644 index 000000000..1d4699968 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_63.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + #include if exists "./simple_tests/include_tests/includes_okay_helper.include" +} diff --git a/parser/tst/simple_tests/include_tests/ok_64.sd b/parser/tst/simple_tests/include_tests/ok_64.sd new file mode 100644 index 000000000..a62d8c7c3 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_64.sd @@ -0,0 +1,8 @@ +# +#=DESCRIPTION include if existss testing - test some "odd" locations of include if existss +#=EXRESULT PASS +# +/does/not/exist { + /does/not/exist mr, #include if exists /bin/true Px, + #include if exists "../tst/simple_tests/include_tests/includes_okay_helper.include" #include if exists +} diff --git a/parser/tst/simple_tests/include_tests/ok_65.sd b/parser/tst/simple_tests/include_tests/ok_65.sd new file mode 100644 index 000000000..6a6ba6fbf --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_65.sd @@ -0,0 +1,9 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of a directory +#=EXRESULT PASS +# +/does/not/exist { + #include if exists + #include if exists "simple_tests/includes/" + #include if exists +} diff --git a/parser/tst/simple_tests/include_tests/ok_66.sd b/parser/tst/simple_tests/include_tests/ok_66.sd new file mode 100644 index 000000000..20c2f5fa6 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_66.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + #include if exists simple_tests/include_tests/includes_okay_helper.include +} diff --git a/parser/tst/simple_tests/include_tests/ok_67.sd b/parser/tst/simple_tests/include_tests/ok_67.sd new file mode 100644 index 000000000..8e6f18325 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_67.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + #include if exists ../tst/simple_tests/include_tests/includes_okay_helper.include +} diff --git a/parser/tst/simple_tests/include_tests/ok_68.sd b/parser/tst/simple_tests/include_tests/ok_68.sd new file mode 100644 index 000000000..5aa15300e --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_68.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + #include if exists ./simple_tests/include_tests/includes_okay_helper.include +} diff --git a/parser/tst/simple_tests/include_tests/ok_69.sd b/parser/tst/simple_tests/include_tests/ok_69.sd new file mode 100644 index 000000000..25cbf7451 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_69.sd @@ -0,0 +1,8 @@ +# +#=DESCRIPTION include if existss testing - test some "odd" locations of include if existss +#=EXRESULT PASS +# +/does/not/exist { + /does/not/exist mr, #include if exists /bin/true Px, + #include if exists ../tst/simple_tests/include_tests/includes_okay_helper.include #include if exists +} diff --git a/parser/tst/simple_tests/include_tests/ok_70.sd b/parser/tst/simple_tests/include_tests/ok_70.sd new file mode 100644 index 000000000..017d9aab1 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_70.sd @@ -0,0 +1,9 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of a directory +#=EXRESULT PASS +# +/does/not/exist { + #include if exists + #include if exists simple_tests/includes/ + #include if exists +} diff --git a/parser/tst/simple_tests/include_tests/ok_76.sd b/parser/tst/simple_tests/include_tests/ok_76.sd new file mode 100644 index 000000000..a8cb0adb0 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_76.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + #include if exists "simple_tests/include_tests/includes with space helper.include" +} diff --git a/parser/tst/simple_tests/include_tests/ok_77.sd b/parser/tst/simple_tests/include_tests/ok_77.sd new file mode 100644 index 000000000..ae1869212 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_77.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + #include if exists "simple_tests/include_tests/includes with space helper.include" #comment +} diff --git a/parser/tst/simple_tests/include_tests/ok_78.sd b/parser/tst/simple_tests/include_tests/ok_78.sd new file mode 100644 index 000000000..978a59777 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_78.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + #include if exists <"include_tests/includes with space helper.include"> +} diff --git a/parser/tst/simple_tests/include_tests/ok_79.sd b/parser/tst/simple_tests/include_tests/ok_79.sd new file mode 100644 index 000000000..fa14a3e78 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_79.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + #include if exists <"include_tests/includes with space helper.include"> #comment +} diff --git a/parser/tst/simple_tests/include_tests/ok_80.sd b/parser/tst/simple_tests/include_tests/ok_80.sd new file mode 100644 index 000000000..9675e405f --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_80.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + #include if exists +} diff --git a/parser/tst/simple_tests/include_tests/ok_81.sd b/parser/tst/simple_tests/include_tests/ok_81.sd new file mode 100644 index 000000000..cf9e05dc8 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_81.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if existss testing - basic include if exists of global and local include +#=EXRESULT PASS +# +/does/not/exist { + #include if exists #comment +} diff --git a/parser/tst/simple_tests/include_tests/ok_82.sd b/parser/tst/simple_tests/include_tests/ok_82.sd new file mode 100644 index 000000000..5fb32a441 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_82.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if exist testing - non-existent include should pass +#=EXRESULT PASS +# +/does/not/exist { + #include if exists "does-not-exist/does-not-exist" +} diff --git a/parser/tst/simple_tests/include_tests/ok_83.sd b/parser/tst/simple_tests/include_tests/ok_83.sd new file mode 100644 index 000000000..0fcc64589 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_83.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if exists testing - abs path include does not exist should pass +#=EXRESULT PASS +# +/does/not/exist { + #include if exists "/does-not-exist/does-not-exist" +} diff --git a/parser/tst/simple_tests/include_tests/ok_84.sd b/parser/tst/simple_tests/include_tests/ok_84.sd new file mode 100644 index 000000000..795ac9d0a --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_84.sd @@ -0,0 +1,8 @@ +# +#=DESCRIPTION include if exists testing - non-existent include should pass +#=EXRESULT PASS +# +/does/not/exist { + #include + #include if exists "../does-not-exist/does-not-exist" +} diff --git a/parser/tst/simple_tests/include_tests/ok_85.sd b/parser/tst/simple_tests/include_tests/ok_85.sd new file mode 100644 index 000000000..795ac9d0a --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_85.sd @@ -0,0 +1,8 @@ +# +#=DESCRIPTION include if exists testing - non-existent include should pass +#=EXRESULT PASS +# +/does/not/exist { + #include + #include if exists "../does-not-exist/does-not-exist" +} diff --git a/parser/tst/simple_tests/include_tests/ok_86.sd b/parser/tst/simple_tests/include_tests/ok_86.sd new file mode 100644 index 000000000..3d32a3fe6 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_86.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if exists testing - non-existent include should pass +#=EXRESULT PASS +# +/does/not/exist { + #include if exists "does-not-exist/does-not-exist" +} diff --git a/parser/tst/simple_tests/include_tests/ok_87.sd b/parser/tst/simple_tests/include_tests/ok_87.sd new file mode 100644 index 000000000..bb9ae2e13 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_87.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION include if exists testing - non-existent include should pass +#=EXRESULT PASS +# +/does/not/exist { + #include if exists +} diff --git a/parser/tst/simple_tests/include_tests/ok_88.sd b/parser/tst/simple_tests/include_tests/ok_88.sd new file mode 100644 index 000000000..219ea0725 --- /dev/null +++ b/parser/tst/simple_tests/include_tests/ok_88.sd @@ -0,0 +1,8 @@ +# +#=DESCRIPTION include if exists testing - non-existent include should pass +#=EXRESULT PASS +# +/does/not/exist { + #include if exists + #include +}