Commit Graph

49 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 4a0645e942 doc: Correctly render --DOC_NO_USAGE + --DOC_GEN_OUTPUT.
It was previously merged into a single block.
2021-09-24 08:42:42 -07:00
Emmanuel Lepage Vallee 883cdb7f41 doc: Fix the rendering of double quotes and semicolons
CMake uses quotes and semicolon in its internal list datatype.

Previously, all double quotes were converted to single quotes to
avoid this problem. Semicolors were interpreted as newlines in
ldoc.

With this commit, both of them render fine. This was required
because a new example uses CSS and XML where those symbols have
a specific meanning.
2021-09-24 08:42:42 -07:00
Emmanuel Lepage Vallée ee3c42652e
Merge pull request #3292 from sclu1034/feature/github_actions
Migrate CI to GitHub Actions
2021-09-10 14:25:54 -07:00
Lucas Schwiderski e0e8f3fd72
doc: Improve hiding lines in examples
This implements variants of `--DOC_HIDE` that allow hiding any amount of
lines with just a start and end marker.

Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
2021-06-17 15:44:41 +02:00
Lucas Schwiderski e7239840f4
docs(github_actions): Remove Travis references
Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
2021-05-06 20:05:02 +02:00
Lucas Schwiderski 19bf83b409
Use CMake Lua variable for coverage runner 2021-03-23 09:10:04 +01:00
Lucas Schwiderski 353ccfb0dd
Make CMake Lua executable customizable
Some platforms, such as Arch Linux, already moved to Lua 5.4, while
offering Lua 5.3 as a separate executable, such as `/usr/bin/lua5.3`.
To be able to build awesomeWM on these platforms without extensive
shims, this change introduces a new CMake variable `LUA_EXECUTABLE`.

Its default is set by `find_program` to the usual `/usr/bin/lua`,
but allows running CMake like this:

```sh
cmake ../ \
    -DLUA_INCLUDE_DIR=/usr/include/lua5.3 \
    -DLUA_LIBRARY=/usr/lib/liblua.so.5.3 \
    -DLUA_EXECUTABLE=/usr/bin/lua5.3
```
2021-03-23 09:10:03 +01:00
Emmanuel Lepage Vallee c48b03ca9c doc: Help the examples with text but no images get generated more often.
In case of error, well, make an error, but update the content anyway.
This will be enough for the CI but makes development less painful.

Also update the cmake targets to re-generate them more often.
2019-08-19 00:24:14 -04:00
Daniel Hahler ddf422dd0d
cmake: fix generate-examples/check-examples (#2545) 2019-02-19 00:15:19 +01:00
Uli Schlachter 2769bdbc5b tests/examples: Run example-tests in build phase, not configure phase
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-06 16:50:46 +02:00
Uli Schlachter be728324ef tests/examples: Change ENV handling
Instead of messing with CMake's environment and having that implicitly
inherited when running a process, explicitly set $SOURCE_DIRECTORY where
required.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-06 16:50:46 +02:00
Uli Schlachter 73b519d38b Fix STRICT_TESTS (#2338)
STRICT_TESTS was introduced in commit c22b93963. Some people have setups
where e.g. fontconfig produces warnings. These warnings made the tests
under tests/examples/ fail. The above commit changes things so that
these warnings are ignored by default, unless STRICT_TESTS is enabled.

Commit b5ca8bf937 broke this by making example test failures fatal
again.

Fix this by appending "|| true" to the command to run in case strict
tests are disabled. Thus, all failures from tests/examples/runner.sh get
ignored.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-08-06 09:05:51 -04:00
Emmanuel Lepage Vallée dd7161ee0a
build: Fix a regression when adding new example tests. (#2337)
If the example had a text output, it would cause an error

Regression from b5ca8bf93
2018-08-06 09:05:31 -04:00
Uli Schlachter 477af1b145 test runner: Move running to a shell script
Instead of running the example tests directly from CMake and checking
the results via CMake, the tests are now run through a shell script.

So far, there are too many variables involved for me to easily figure
out how to run this shell script in the building phase instead of the
configuring phase, but at least this commit moves the "actual running"
out of CMake, bringing us a step closer to that goal.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-31 17:50:41 +02:00
Uli Schlachter b5ca8bf937 example tests: Save expected test output in a txt file
This commit adds a .txt file next to each example test that generates a
text output. This text file contains the expected output and it is an
error if the actual output does not match the expected output. This
means that we no longer have to run the example tests before we can
expand all the @foo@ expressions that occur.

While touching this, I also fixed some typos and unexpected newlines in
the tests' output.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-27 08:56:18 +02:00
mergify[bot] e7251011ac
Merge pull request #2314 from Elv13/add_example_generator_options
Add example generator options
2018-07-25 07:15:18 +00:00
Emmanuel Lepage Vallee 4e8d907044 tests: Restore support for newlines in examples
Since last year luacheck change, trailing spaces are no longer
allowed. This caused all documentaiton examples that used them
as a way to mark newlines to look plain wrong.

This commit add an explicit flag to make longer examples more
readable.
2018-07-24 17:22:41 -04:00
Emmanuel Lepage Vallee c340c14cf2 tests: Improve the CMakeLists.txt
* Add a FOLLOW_SYMLINKS so Awesome 3rd party module can share the
  awesome test infrastructure by adding themselves as symlinks in
  `lib/`, `tests/` and `tests/examples` and otherwise use AwesomeWM
  Travis config.

* Add an option to add examples to the C documentation. Previously only
  Lua functions could be documented using this framework.
2018-07-24 17:22:41 -04:00
Uli Schlachter e1a90ecf5b tests/examples: Explicitly mark tests generating text
This is similar to the previous commit, but for text output that is
produced by some test.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-24 14:27:41 +02:00
Uli Schlachter 654eecd40d tests/examples: Explicitly mark tests generating an image
This allows to figure out if a test will generate an image without
having to run it. The long term plan for this is to run the tests during
compiling ("make") and not during configuring ("cmake"). Since the list
of files to e.g. install needs to be known during configuring, this
commit is a necessary step in that direction.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-24 14:12:44 +02:00
Uli Schlachter efe23dc7d2 tests/examples: Drop support for PNG output images
No currently existing test produces a PNG image, so why do we even check
for such an output file?

I did 'rm -rf build && make -j9 && cp -r build /tmp', then applied this
patch, and then did another 'rm -rf build && make -j9'. According to
diff, the resulting directories are basically the same (except for lots
of timestamps and some non-determinism in CMake).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-07-24 13:49:43 +02:00
Daniel Hahler d1d794ab2d tests/examples/CMakeLists.txt: remove EXAMPLE_DOC_SOURCE_FILES
The caching is not reliable, and cannot be made so easily.
2017-10-22 15:55:50 +02:00
Daniel Hahler f3baf499aa tests/examples/CMakeLists.txt: set env via LUA_COV_RUNNER only (#2072)
LUA_COV_RUNNER is used with `add_custom_command` for the command to
generate the images, and AWESOME_THEMES_PATH should be set there.

Since LUA_COV_RUNNER is used also with `execute_process` there is no
need for `set(ENV …)` anymore.
2017-10-22 15:47:53 +02:00
Emmanuel Lepage Vallee 15b025ff91 tests: Add the theme path ENV variable
That way theme assets can be used by the documentation images
2017-10-21 17:50:38 +02:00
Daniel Hahler 02f894ce0c Improve tests/examples: generate deps for output files (#1962)
This still runs all the tests in the configure phase, since the tests
report back what output file (png/svg/none) will be generated.. :/

This could be improved by having this table in CMakeLists directly, or
by having a callback into the tests that only reports back that
information.  The latter would still execute all the tests (via a Lua
process).

Adds an explicit check-examples target.
2017-08-31 21:21:19 +02:00
Daniel Hahler 8923df4a5f build: make DO_COVERAGE a CMake variable
Travis: remove CXXFLAGS (not used), LDFLAGS (typo, not used)

Closes https://github.com/awesomeWM/awesome/pull/2001.
2017-08-29 22:24:12 +02:00
Uli Schlachter d33d7d71d7 tests/examples/CMakeLists.txt: Add a project() call (#1926)
project() automatically sets the PROJECT_NAME variable. Thus, when this
CMake code is run due to being included by awesome, this commit has no
effect.

When this CMake code is run on its own, CMake will no longer check for a
C and C++ compiler.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-07-17 10:11:52 +02:00
Emmanuel Lepage Vallee f448a604b7 cmake: Add a --DOC_NO_DASH option to the doc examples framework
This way it can be used in documentation pages.
2017-02-12 22:19:08 +01:00
Daniel Hahler eacc49243b tests/examples/CMakeLists.txt: invoke luacov with `lua` directly 2017-01-08 20:34:13 +01:00
Daniel Hahler 6aee6c2053 ci: overhaul coverage processing
- Execute the tests without compiling, and don't mess with the source
   files when coverage is enabled.
   This ensures that the coverage report lines are correct.
   This disables the doc tests, as their results would be unused.
   Hack: it still expands macros on util.lua, because of
   `util.get_themes_dir()` and `util.get_awesome_icon_dir()`, which might
   be moved later.  Ref:
   https://github.com/awesomeWM/awesome/pull/1239#discussion_r93828178.
 - ensure that BUILD_APIDOC and DO_COVERAGE are not used together
 - awesomeConfig.cmake: add DO_COVERAGE as an option
 - Travis: only install codecov with DO_COVERAGE=codecov
 - Travis: do not use set -v; use set -x with DO_COVERAGE
 - do not use trailing slashes with dirs in tests/examples/CMakeLists.txt / .luacov
 - Use latest luacov (0.12.0-1) again
   This reverts parts of 4cc6a815.
   I think it is better to fix any failure that 4cc6a815 tried to work around.
 - Travis: simplify/fix require('luacov') for functionaltests
 - tests/examples/CMakeLists.txt: resolve ../.. in SOURCE_DIR
 - tests/examples/CMakeLists.txt: add DO_COVERAGE to env
 - Cleanup/simplify .luacov: work with SOURCE_DIRECTORY alone
 - tests/run.sh: pass through / set SOURCE_DIRECTORY when running awesome
 - tests/run.sh: resolve source_dir
 - use DO_COVERAGE from env only
2017-01-08 20:34:13 +01:00
Emmanuel Lepage Vallee ad203232c4 cmake: Add an extra space to the @usage code
Otherwise commented lines look like ---- My comment
instead of -- -- My comment. This wasn't a problem before the
intentation fix commit, but it is now.
2017-01-03 00:07:57 -05:00
Uli Schlachter 7d3b7fc48a Add vim modelines to all CMake files
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 14:02:14 +01:00
Uli Schlachter af59d52ddf Slightly change DOC_HIDE magic
The following commits will add DOC_HIDE uses that are not at the end of
the line, but the beginning. Hence, drop the requirement that it appears
at the end of the line and change the ".+" at the beginning into ".*".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-31 13:58:35 +01:00
Emmanuel Lepage Vallee e01de8d977 tests: Expose the themes to the examples tests 2016-12-11 00:10:39 -05:00
Daniel Hahler 86bc579649 Improve messages with tests/examples/CMakeLists.txt 2016-10-01 17:24:44 +02:00
Daniel Hahler 84e7875e50 minor: fix doc for tests/examples/CMakeLists.txt 2016-10-01 17:24:03 +02:00
Crazy Lemon ffa7519730 Has the example test runner unset env variables that would interfere (#1106)
with using LUA_PATH for the `package.path` default valua for the shim tests
2016-09-20 19:36:23 +02:00
Uli Schlachter c22b939630 Be less strict about warnings from "example tests" (#1045)
The build is no longer aborted when one of the "example tests" produces a
message on stderr. However, on Travis this requirement is still made. This
should catch "bad errors" via Travis while not breaking the build for users.

Fixes: https://github.com/awesomeWM/awesome/issues/821
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-08-20 18:59:28 +02:00
Uli Schlachter 7488f80be7 tests/example/: Print status messages
Running the tests sadly takes much to long. Since I don't have a good idea what
to do about this (I'd like to run all tests in a single Lua process, but that
doesn't seem to be possible easily), instead let's just make it more explicit
what is being done. This commit prints a message for each test that is being
run.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-11 10:24:34 +02:00
Uli Schlachter ca074dc689 tests/example/: Remove environment hack
Now that tests are no longer scanned for recursively, the hack of passing values
back and forth via the environment is no longer needed and can be removed.

While at it, this also exchanges the "useless use of regex" for an explicit
string replacement.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-11 10:24:34 +02:00
Uli Schlachter a7d6699d5d tests/example/: Replace recursion with iteration
Instead of recursively walking the directory tree, this commit makes the code us
GLOB_RECURSE to find all files and then handles them on after another.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-11 10:24:34 +02:00
Uli Schlachter 77f867ff57 tests/example/: Explcitly compute namespace
The namespace of e.g. "tests/examples/awful/mouse/coords.lua" is "_awful_mouse".
This is purely based on the path of the file.

Previously, this was computed while recursively scanning the directory tree.
This commit instead moves this to an extra function that handles this task.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-11 10:24:34 +02:00
Uli Schlachter 5fb6ca8194 tests/example/: Make search for template.lua explicit
Previously, while recursively scanning the directory tree, the code in here also
scanned for template.lua files and remembered the latest one it found. This
commit adds a function which finds the right template.lua for a given file name,
making this search explicit and easier to understand.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-11 10:24:34 +02:00
Uli Schlachter ffe64727fe Silence warnings in examples (#944)
There was a problem that the examples were considered to have failed as soon as
they produced any kind of output, but there were legitimate cases of warnings
being printed that triggered these checks. Commit 4819be4f4f used a
regular expression to detect and ignore this warnings.

This commit reverts the above commit and instead silences the warnings by
monkey-patching the function that prints the warnings into a no-op.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-07 22:57:01 +02:00
Emmanuel Lepage Vallee ac7ea4c70f tests: Fix coverage data
As the documentation generation insert increasingly large ammount
of code into the lua files, the coverage data is getting less and
less accurate. This try to fix this by only collecting such data
after the `configure_file` calls are done.
2016-05-30 17:51:19 -04:00
Emmanuel Lepage Vallee bb0a2addb4 tests: Add an option to disable @usage ldoc tag 2016-04-30 04:27:34 -04:00
Emmanuel Lepage Vallee 4819be4f4f build: Do not exit when gears.debug.print_warning are issued 2016-04-03 23:45:56 -04:00
Emmanuel Lepage Vallee 421c10b19a Change autogenerated images name
Github drop files when the leading character is ., ~, # or _

This commit add a prefix in front of the name to avoid leading
underscores.
2016-03-31 23:42:05 -04:00
Emmanuel Lepage Vallee e7652a053d tests: Add a new testing framework 2016-03-31 04:45:45 -04:00