{"action":"created","issue":{"url":"https://api.github.com/repos/balabit/syslog-ng/issues/1878","repository_url":"https://api.github.com/repos/balabit/syslog-ng","labels_url":"https://api.github.com/repos/balabit/syslog-ng/issues/1878/labels{/name}","comments_url":"https://api.github.com/repos/balabit/syslog-ng/issues/1878/comments","events_url":"https://api.github.com/repos/balabit/syslog-ng/issues/1878/events","html_url":"https://github.com/balabit/syslog-ng/pull/1878","id":295227568,"number":1878,"title":"[WIP] cmake: do not compile criterion unit tests when criterion missing","user":{"login":"furiel","id":11007226,"avatar_url":"https://avatars0.githubusercontent.com/u/11007226?v=4","gravatar_id":"","url":"https://api.github.com/users/furiel","html_url":"https://github.com/furiel","followers_url":"https://api.github.com/users/furiel/followers","following_url":"https://api.github.com/users/furiel/following{/other_user}","gists_url":"https://api.github.com/users/furiel/gists{/gist_id}","starred_url":"https://api.github.com/users/furiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/furiel/subscriptions","organizations_url":"https://api.github.com/users/furiel/orgs","repos_url":"https://api.github.com/users/furiel/repos","events_url":"https://api.github.com/users/furiel/events{/privacy}","received_events_url":"https://api.github.com/users/furiel/received_events","type":"User","site_admin":false},"labels":[{"id":122658708,"url":"https://api.github.com/repos/balabit/syslog-ng/labels/needs-review","name":"needs-review","color":"bfe5bf","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2018-02-07T17:34:27Z","updated_at":"2018-02-27T14:06:24Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/balabit/syslog-ng/pulls/1878","html_url":"https://github.com/balabit/syslog-ng/pull/1878","diff_url":"https://github.com/balabit/syslog-ng/pull/1878.diff","patch_url":"https://github.com/balabit/syslog-ng/pull/1878.patch"},"body":"check target in autotools and test target in cmake depend on the detection of criterion. Prior this patch, unit tests were silently excluded from the test set.\r\n\r\n- Autotools\r\nAs autotools creates check, recursive-check, local-check targets automatically, the best I could come up with is to add an extra dependency to check target, that triggers configure failure in case testing is disabled.\r\n\r\n```\r\n$ make check\r\nMakefile:18487: *** \"Unit tests disabled\".  Stop.\r\n```\r\n- cmake\r\nIn cmake, I could completely disable the test target:\r\n```\r\n$ make test\r\nmake: *** No rule to make target 'test'.  Stop.\r\n```\r\nThough in cmake: the test code is compiled together with the code, one important difference to autotools. Meaning we need to expicitely disable compiling unit tests.\r\n\r\nThe first idea is an early return in add_unit_test() function. Though this is not enough, because some tests do not use this function: those need special configuration for their target: extra cflags, make-clean files, compiler-switch values.\r\n\r\nThe alternative is to add an early return in add_unit_test(), and decorate those exceptions with BUILD_TESTING. The problem is one does not expect that this BUILD_TESTING needs to be used, because typically we go with add_unit_test().\r\n\r\nSo in the end I added an add_test_subdirectory, which is a wrapper around add_subdirectory(), this is the intended api to use. add_test_subdirectory() will not go in a directory if BUILD_TESTING is disabled."},"comment":{"url":"https://api.github.com/repos/balabit/syslog-ng/issues/comments/368888688","html_url":"https://github.com/balabit/syslog-ng/pull/1878#issuecomment-368888688","issue_url":"https://api.github.com/repos/balabit/syslog-ng/issues/1878","id":368888688,"user":{"login":"furiel","id":11007226,"avatar_url":"https://avatars0.githubusercontent.com/u/11007226?v=4","gravatar_id":"","url":"https://api.github.com/users/furiel","html_url":"https://github.com/furiel","followers_url":"https://api.github.com/users/furiel/followers","following_url":"https://api.github.com/users/furiel/following{/other_user}","gists_url":"https://api.github.com/users/furiel/gists{/gist_id}","starred_url":"https://api.github.com/users/furiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/furiel/subscriptions","organizations_url":"https://api.github.com/users/furiel/orgs","repos_url":"https://api.github.com/users/furiel/repos","events_url":"https://api.github.com/users/furiel/events{/privacy}","received_events_url":"https://api.github.com/users/furiel/received_events","type":"User","site_admin":false},"created_at":"2018-02-27T14:06:24Z","updated_at":"2018-02-27T14:06:24Z","author_association":"CONTRIBUTOR","body":"Ok, I removed unit test execution by `+override_dh_auto_test: ;`, see latest patch.\r\n\r\n@mochrul I checked the debian packaging files in sid, and I see there is no criterion there either, but the tests are enabled. Meaning this PR will break the packaging for you. You will need to apply a similar change in debian packaging.\r\n\r\n@czanik not sure about rpm, but probably you are affected as well. Can you check/follow this PR?"}}
{"actor":{"display_login":"furiel"}}