From f3b6c03f21e45edd2220cb6fc996fe4b5fa11bb8 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Fri, 28 Apr 2017 00:26:32 +0200 Subject: make: settings: do not read output_dir from blogcfile now it is only possible to override output directory using environment variable. this commit also reduces the number trie lookups. --- tests/blogc-make/check_blogc_make.sh.in | 161 ++++++++++++++++---------------- tests/blogc-make/check_settings.c | 14 +-- 2 files changed, 83 insertions(+), 92 deletions(-) (limited to 'tests/blogc-make') diff --git a/tests/blogc-make/check_blogc_make.sh.in b/tests/blogc-make/check_blogc_make.sh.in index 2dccc6c..bf71c65 100755 --- a/tests/blogc-make/check_blogc_make.sh.in +++ b/tests/blogc-make/check_blogc_make.sh.in @@ -467,7 +467,6 @@ content_dir = contents template_dir = temp main_template = main.html source_ext = .blogc -output_dir = _blogc_build pagination_prefix = pagination posts_per_page = 1 atom_posts_per_page = 1 @@ -493,12 +492,12 @@ bar EOF ${TESTS_ENVIRONMENT} @abs_top_builddir@/blogc-make -f "${TEMP}/proj/blogcfile" 2>&1 | tee "${TEMP}/output.txt" -grep "_blogc_build/posts\\.html" "${TEMP}/output.txt" -grep "_blogc_build/atoom/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/pagination/1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/2\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/foo\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/bar\\.html" "${TEMP}/output.txt" +grep "_build/posts\\.html" "${TEMP}/output.txt" +grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" +grep "_build/pagination/1\\.html" "${TEMP}/output.txt" +grep "_build/pagination/2\\.html" "${TEMP}/output.txt" +grep "_build/poost/foo\\.html" "${TEMP}/output.txt" +grep "_build/poost/bar\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" @@ -508,8 +507,8 @@ Listing: Foo - Oct 01, 2016 EOF -diff -uN "${TEMP}/proj/_blogc_build/posts.html" "${TEMP}/expected-index.html" -diff -uN "${TEMP}/proj/_blogc_build/pagination/1.html" "${TEMP}/expected-index.html" +diff -uN "${TEMP}/proj/_build/posts.html" "${TEMP}/expected-index.html" +diff -uN "${TEMP}/proj/_build/pagination/1.html" "${TEMP}/expected-index.html" cat > "${TEMP}/expected-page-2.html" < "${TEMP}/expected-atom.xml" < @@ -549,7 +548,7 @@ cat > "${TEMP}/expected-atom.xml" < EOF -diff -uN "${TEMP}/proj/_blogc_build/atoom/index.xml" "${TEMP}/expected-atom.xml" +diff -uN "${TEMP}/proj/_build/atoom/index.xml" "${TEMP}/expected-atom.xml" cat > "${TEMP}/expected-post-foo.html" < "${TEMP}/expected-post-bar.html" <&1 | tee "${TEMP}/output.txt" -grep "_blogc_build/posts\\.html" "${TEMP}/output.txt" -grep "_blogc_build/atoom/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/pagination/1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/2\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/3\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/foo\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/bar\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/baz\\.html" "${TEMP}/output.txt" -grep "_blogc_build/taag/tag1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/taag/tag2\\.html" "${TEMP}/output.txt" +grep "_build/posts\\.html" "${TEMP}/output.txt" +grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" +grep "_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" +grep "_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" +grep "_build/pagination/1\\.html" "${TEMP}/output.txt" +grep "_build/pagination/2\\.html" "${TEMP}/output.txt" +grep "_build/pagination/3\\.html" "${TEMP}/output.txt" +grep "_build/poost/foo\\.html" "${TEMP}/output.txt" +grep "_build/poost/bar\\.html" "${TEMP}/output.txt" +grep "_build/poost/baz\\.html" "${TEMP}/output.txt" +grep "_build/taag/tag1\\.html" "${TEMP}/output.txt" +grep "_build/taag/tag2\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" -diff -uN "${TEMP}/proj/_blogc_build/posts.html" "${TEMP}/expected-index.html" -diff -uN "${TEMP}/proj/_blogc_build/pagination/1.html" "${TEMP}/expected-index.html" -diff -uN "${TEMP}/proj/_blogc_build/pagination/2.html" "${TEMP}/expected-page-2.html" +diff -uN "${TEMP}/proj/_build/posts.html" "${TEMP}/expected-index.html" +diff -uN "${TEMP}/proj/_build/pagination/1.html" "${TEMP}/expected-index.html" +diff -uN "${TEMP}/proj/_build/pagination/2.html" "${TEMP}/expected-page-2.html" cat > "${TEMP}/expected-page-3.html" < "${TEMP}/expected-atom-tag1.xml" < @@ -653,7 +652,7 @@ cat > "${TEMP}/expected-atom-tag1.xml" < EOF -diff -uN "${TEMP}/proj/_blogc_build/atoom/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml" +diff -uN "${TEMP}/proj/_build/atoom/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml" cat > "${TEMP}/expected-atom-tag2.xml" < @@ -685,7 +684,7 @@ cat > "${TEMP}/expected-atom-tag2.xml" < EOF -diff -uN "${TEMP}/proj/_blogc_build/atoom/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml" +diff -uN "${TEMP}/proj/_build/atoom/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml" cat > "${TEMP}/expected-post-baz.html" < "${TEMP}/expected-tag1.html" < "${TEMP}/expected-tag2.html" <&1 | tee "${TEMP}/output.txt" -grep "_blogc_build/posts\\.html" "${TEMP}/output.txt" -grep "_blogc_build/atoom/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/pagination/1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/2\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/3\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/foo\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/bar\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/baz\\.html" "${TEMP}/output.txt" -grep "_blogc_build/taag/tag1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/taag/tag2\\.html" "${TEMP}/output.txt" -grep "_blogc_build/page1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/page2\\.html" "${TEMP}/output.txt" +grep "_build/posts\\.html" "${TEMP}/output.txt" +grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" +grep "_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" +grep "_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" +grep "_build/pagination/1\\.html" "${TEMP}/output.txt" +grep "_build/pagination/2\\.html" "${TEMP}/output.txt" +grep "_build/pagination/3\\.html" "${TEMP}/output.txt" +grep "_build/poost/foo\\.html" "${TEMP}/output.txt" +grep "_build/poost/bar\\.html" "${TEMP}/output.txt" +grep "_build/poost/baz\\.html" "${TEMP}/output.txt" +grep "_build/taag/tag1\\.html" "${TEMP}/output.txt" +grep "_build/taag/tag2\\.html" "${TEMP}/output.txt" +grep "_build/page1\\.html" "${TEMP}/output.txt" +grep "_build/page2\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" -diff -uN "${TEMP}/proj/_blogc_build/posts.html" "${TEMP}/expected-index.html" -diff -uN "${TEMP}/proj/_blogc_build/pagination/1.html" "${TEMP}/expected-index.html" -diff -uN "${TEMP}/proj/_blogc_build/pagination/2.html" "${TEMP}/expected-page-2.html" -diff -uN "${TEMP}/proj/_blogc_build/pagination/3.html" "${TEMP}/expected-page-3.html" +diff -uN "${TEMP}/proj/_build/posts.html" "${TEMP}/expected-index.html" +diff -uN "${TEMP}/proj/_build/pagination/1.html" "${TEMP}/expected-index.html" +diff -uN "${TEMP}/proj/_build/pagination/2.html" "${TEMP}/expected-page-2.html" +diff -uN "${TEMP}/proj/_build/pagination/3.html" "${TEMP}/expected-page-3.html" -diff -uN "${TEMP}/proj/_blogc_build/atoom/index.xml" "${TEMP}/expected-atom.xml" -diff -uN "${TEMP}/proj/_blogc_build/atoom/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml" -diff -uN "${TEMP}/proj/_blogc_build/atoom/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml" +diff -uN "${TEMP}/proj/_build/atoom/index.xml" "${TEMP}/expected-atom.xml" +diff -uN "${TEMP}/proj/_build/atoom/tag1/index.xml" "${TEMP}/expected-atom-tag1.xml" +diff -uN "${TEMP}/proj/_build/atoom/tag2/index.xml" "${TEMP}/expected-atom-tag2.xml" -diff -uN "${TEMP}/proj/_blogc_build/poost/foo.html" "${TEMP}/expected-post-foo.html" -diff -uN "${TEMP}/proj/_blogc_build/poost/bar.html" "${TEMP}/expected-post-bar.html" -diff -uN "${TEMP}/proj/_blogc_build/poost/baz.html" "${TEMP}/expected-post-baz.html" +diff -uN "${TEMP}/proj/_build/poost/foo.html" "${TEMP}/expected-post-foo.html" +diff -uN "${TEMP}/proj/_build/poost/bar.html" "${TEMP}/expected-post-bar.html" +diff -uN "${TEMP}/proj/_build/poost/baz.html" "${TEMP}/expected-post-baz.html" -diff -uN "${TEMP}/proj/_blogc_build/taag/tag1.html" "${TEMP}/expected-tag1.html" -diff -uN "${TEMP}/proj/_blogc_build/taag/tag2.html" "${TEMP}/expected-tag2.html" +diff -uN "${TEMP}/proj/_build/taag/tag1.html" "${TEMP}/expected-tag1.html" +diff -uN "${TEMP}/proj/_build/taag/tag2.html" "${TEMP}/expected-tag2.html" cat > "${TEMP}/expected-page1.html" < "${TEMP}/expected-page2.html" <&1 | tee "${TEMP}/output.txt" -grep "_blogc_build/posts\\.html" "${TEMP}/output.txt" -grep "_blogc_build/atoom/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" -grep "_blogc_build/pagination/1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/2\\.html" "${TEMP}/output.txt" -grep "_blogc_build/pagination/3\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/foo\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/bar\\.html" "${TEMP}/output.txt" -grep "_blogc_build/poost/baz\\.html" "${TEMP}/output.txt" -grep "_blogc_build/taag/tag1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/taag/tag2\\.html" "${TEMP}/output.txt" -grep "_blogc_build/page1\\.html" "${TEMP}/output.txt" -grep "_blogc_build/page2\\.html" "${TEMP}/output.txt" +grep "_build/posts\\.html" "${TEMP}/output.txt" +grep "_build/atoom/index\\.xml" "${TEMP}/output.txt" +grep "_build/atoom/tag1/index\\.xml" "${TEMP}/output.txt" +grep "_build/atoom/tag2/index\\.xml" "${TEMP}/output.txt" +grep "_build/pagination/1\\.html" "${TEMP}/output.txt" +grep "_build/pagination/2\\.html" "${TEMP}/output.txt" +grep "_build/pagination/3\\.html" "${TEMP}/output.txt" +grep "_build/poost/foo\\.html" "${TEMP}/output.txt" +grep "_build/poost/bar\\.html" "${TEMP}/output.txt" +grep "_build/poost/baz\\.html" "${TEMP}/output.txt" +grep "_build/taag/tag1\\.html" "${TEMP}/output.txt" +grep "_build/taag/tag2\\.html" "${TEMP}/output.txt" +grep "_build/page1\\.html" "${TEMP}/output.txt" +grep "_build/page2\\.html" "${TEMP}/output.txt" rm "${TEMP}/output.txt" -[[ ! -d "${TEMP}/proj/_blogc_build" ]] +[[ ! -d "${TEMP}/proj/_build" ]] export OUTPUT_DIR="${TEMP}/___blogc_build" diff --git a/tests/blogc-make/check_settings.c b/tests/blogc-make/check_settings.c index fab1dd6..4016e15 100644 --- a/tests/blogc-make/check_settings.c +++ b/tests/blogc-make/check_settings.c @@ -39,7 +39,6 @@ test_settings(void **state) { const char *a = "[settings]\n" - "output_dir = bola\n" "content_dir = guda\n" "main_template = foo.tmpl\n" "\n" @@ -62,7 +61,6 @@ test_settings_env(void **state) { const char *a = "[settings]\n" - "output_dir = bola\n" "content_dir = guda\n" "main_template = foo.tmpl\n" "\n" @@ -85,7 +83,6 @@ test_settings2(void **state) { const char *a = "[settings]\n" - "output_dir = bola\n" "content_dir = guda\n" "main_template = foo.tmpl\n" "\n" @@ -129,10 +126,9 @@ test_settings2(void **state) assert_string_equal(bc_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu"); assert_string_equal(bc_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline"); assert_string_equal(bc_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com"); - assert_int_equal(bc_trie_size(s->settings), 14); + assert_int_equal(bc_trie_size(s->settings), 13); assert_string_equal(bc_trie_lookup(s->settings, "source_ext"), ".txt"); assert_string_equal(bc_trie_lookup(s->settings, "html_ext"), "/index.html"); - assert_string_equal(bc_trie_lookup(s->settings, "output_dir"), "bola"); assert_string_equal(bc_trie_lookup(s->settings, "content_dir"), "guda"); assert_string_equal(bc_trie_lookup(s->settings, "template_dir"), "templates"); assert_string_equal(bc_trie_lookup(s->settings, "main_template"), "foo.tmpl"); @@ -174,7 +170,6 @@ test_settings_env2(void **state) { const char *a = "[settings]\n" - "output_dir = bola\n" "content_dir = guda\n" "main_template = foo.tmpl\n" "\n" @@ -218,10 +213,9 @@ test_settings_env2(void **state) assert_string_equal(bc_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu"); assert_string_equal(bc_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline"); assert_string_equal(bc_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com"); - assert_int_equal(bc_trie_size(s->settings), 14); + assert_int_equal(bc_trie_size(s->settings), 13); assert_string_equal(bc_trie_lookup(s->settings, "source_ext"), ".txt"); assert_string_equal(bc_trie_lookup(s->settings, "html_ext"), "/index.html"); - assert_string_equal(bc_trie_lookup(s->settings, "output_dir"), "bola"); assert_string_equal(bc_trie_lookup(s->settings, "content_dir"), "guda"); assert_string_equal(bc_trie_lookup(s->settings, "template_dir"), "templates"); assert_string_equal(bc_trie_lookup(s->settings, "main_template"), "foo.tmpl"); @@ -263,7 +257,6 @@ test_settings_copy_files(void **state) { const char *a = "[settings]\n" - "output_dir = bola\n" "content_dir = guda\n" "main_template = foo.tmpl\n" "\n" @@ -307,10 +300,9 @@ test_settings_copy_files(void **state) assert_string_equal(bc_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu"); assert_string_equal(bc_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline"); assert_string_equal(bc_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com"); - assert_int_equal(bc_trie_size(s->settings), 14); + assert_int_equal(bc_trie_size(s->settings), 13); assert_string_equal(bc_trie_lookup(s->settings, "source_ext"), ".txt"); assert_string_equal(bc_trie_lookup(s->settings, "html_ext"), "/index.html"); - assert_string_equal(bc_trie_lookup(s->settings, "output_dir"), "bola"); assert_string_equal(bc_trie_lookup(s->settings, "content_dir"), "guda"); assert_string_equal(bc_trie_lookup(s->settings, "template_dir"), "templates"); assert_string_equal(bc_trie_lookup(s->settings, "main_template"), "foo.tmpl"); -- cgit v1.2.3-18-g5258