From b5d7154100a49198ddfade99f75e5d26cd408154 Mon Sep 17 00:00:00 2001 From: Tyler Hicks Date: Tue, 31 May 2016 15:38:36 -0500 Subject: [PATCH] parser: Add tests for rules with change_profile exec modes Simple tests that validate the parser's ability to handle change_profile rules containing an exec mode. Signed-off-by: Tyler Hicks Acked-by: John Johansen --- parser/tst/simple_tests/change_profile/safe_bad_1.sd | 7 +++++++ parser/tst/simple_tests/change_profile/safe_bad_2.sd | 7 +++++++ parser/tst/simple_tests/change_profile/safe_ok_1.sd | 7 +++++++ parser/tst/simple_tests/change_profile/safe_ok_2.sd | 7 +++++++ parser/tst/simple_tests/change_profile/safe_ok_3.sd | 7 +++++++ parser/tst/simple_tests/change_profile/unsafe_bad_1.sd | 7 +++++++ parser/tst/simple_tests/change_profile/unsafe_bad_2.sd | 7 +++++++ parser/tst/simple_tests/change_profile/unsafe_ok_1.sd | 7 +++++++ parser/tst/simple_tests/change_profile/unsafe_ok_2.sd | 7 +++++++ parser/tst/simple_tests/change_profile/unsafe_ok_3.sd | 7 +++++++ 10 files changed, 70 insertions(+) create mode 100644 parser/tst/simple_tests/change_profile/safe_bad_1.sd create mode 100644 parser/tst/simple_tests/change_profile/safe_bad_2.sd create mode 100644 parser/tst/simple_tests/change_profile/safe_ok_1.sd create mode 100644 parser/tst/simple_tests/change_profile/safe_ok_2.sd create mode 100644 parser/tst/simple_tests/change_profile/safe_ok_3.sd create mode 100644 parser/tst/simple_tests/change_profile/unsafe_bad_1.sd create mode 100644 parser/tst/simple_tests/change_profile/unsafe_bad_2.sd create mode 100644 parser/tst/simple_tests/change_profile/unsafe_ok_1.sd create mode 100644 parser/tst/simple_tests/change_profile/unsafe_ok_2.sd create mode 100644 parser/tst/simple_tests/change_profile/unsafe_ok_3.sd diff --git a/parser/tst/simple_tests/change_profile/safe_bad_1.sd b/parser/tst/simple_tests/change_profile/safe_bad_1.sd new file mode 100644 index 000000000..0526002ba --- /dev/null +++ b/parser/tst/simple_tests/change_profile/safe_bad_1.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION change_profile w/ safe modifier but no exec condition +#=EXRESULT FAIL +# +/usr/bin/foo { + change_profile safe, +} diff --git a/parser/tst/simple_tests/change_profile/safe_bad_2.sd b/parser/tst/simple_tests/change_profile/safe_bad_2.sd new file mode 100644 index 000000000..2c63d9a6a --- /dev/null +++ b/parser/tst/simple_tests/change_profile/safe_bad_2.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION change_profile w/ safe modifier but no exec condition +#=EXRESULT FAIL +# +/usr/bin/foo { + change_profile safe -> baz, +} diff --git a/parser/tst/simple_tests/change_profile/safe_ok_1.sd b/parser/tst/simple_tests/change_profile/safe_ok_1.sd new file mode 100644 index 000000000..0860d31f2 --- /dev/null +++ b/parser/tst/simple_tests/change_profile/safe_ok_1.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION change_profile w/ safe modifier +#=EXRESULT PASS +# +/usr/bin/foo { + change_profile safe /usr/bin/bar -> baz, +} diff --git a/parser/tst/simple_tests/change_profile/safe_ok_2.sd b/parser/tst/simple_tests/change_profile/safe_ok_2.sd new file mode 100644 index 000000000..f6ae24dda --- /dev/null +++ b/parser/tst/simple_tests/change_profile/safe_ok_2.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION change_profile w/ safe modifier +#=EXRESULT PASS +# +/usr/bin/foo { + change_profile safe /usr/bin/bar, +} diff --git a/parser/tst/simple_tests/change_profile/safe_ok_3.sd b/parser/tst/simple_tests/change_profile/safe_ok_3.sd new file mode 100644 index 000000000..1c24b18b2 --- /dev/null +++ b/parser/tst/simple_tests/change_profile/safe_ok_3.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION change_profile w/ safe modifier and "safe" target +#=EXRESULT PASS +# +/usr/bin/foo { + change_profile safe /usr/bin/bar -> safe, +} diff --git a/parser/tst/simple_tests/change_profile/unsafe_bad_1.sd b/parser/tst/simple_tests/change_profile/unsafe_bad_1.sd new file mode 100644 index 000000000..74cd1975f --- /dev/null +++ b/parser/tst/simple_tests/change_profile/unsafe_bad_1.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION change_profile w/ unsafe modifier but no exec condition +#=EXRESULT FAIL +# +/usr/bin/foo { + change_profile unsafe, +} diff --git a/parser/tst/simple_tests/change_profile/unsafe_bad_2.sd b/parser/tst/simple_tests/change_profile/unsafe_bad_2.sd new file mode 100644 index 000000000..0899cbbe0 --- /dev/null +++ b/parser/tst/simple_tests/change_profile/unsafe_bad_2.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION change_profile w/ unsafe modifier but no exec condition +#=EXRESULT FAIL +# +/usr/bin/foo { + change_profile unsafe -> baz, +} diff --git a/parser/tst/simple_tests/change_profile/unsafe_ok_1.sd b/parser/tst/simple_tests/change_profile/unsafe_ok_1.sd new file mode 100644 index 000000000..e60495f5c --- /dev/null +++ b/parser/tst/simple_tests/change_profile/unsafe_ok_1.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION change_profile w/ unsafe modifier +#=EXRESULT PASS +# +/usr/bin/foo { + change_profile unsafe /usr/bin/bar -> baz, +} diff --git a/parser/tst/simple_tests/change_profile/unsafe_ok_2.sd b/parser/tst/simple_tests/change_profile/unsafe_ok_2.sd new file mode 100644 index 000000000..84595f447 --- /dev/null +++ b/parser/tst/simple_tests/change_profile/unsafe_ok_2.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION change_profile w/ unsafe modifier +#=EXRESULT PASS +# +/usr/bin/foo { + change_profile unsafe /usr/bin/bar, +} diff --git a/parser/tst/simple_tests/change_profile/unsafe_ok_3.sd b/parser/tst/simple_tests/change_profile/unsafe_ok_3.sd new file mode 100644 index 000000000..f64e7ec26 --- /dev/null +++ b/parser/tst/simple_tests/change_profile/unsafe_ok_3.sd @@ -0,0 +1,7 @@ +# +#=DESCRIPTION change_profile w/ unsafe modifier and "unsafe" target +#=EXRESULT PASS +# +/usr/bin/foo { + change_profile unsafe /usr/bin/bar -> unsafe, +}