Commit Graph

167 Commits

Author SHA1 Message Date
Brad King 756169ac99 Tests: Update ModuleNotices test for new notice 2016-09-27 15:18:07 -04:00
Ruslan Baratov 751f7b5255 string(TIMESTAMP ...): add '%a' and '%b' format specifiers
%b: Abbreviated month name (e.g. Oct).
%a: Abbreviated weekday name (e.g. Fri).
2016-09-12 19:07:38 +03:00
Chuck Atkins 02d177c9cc Add additional <= and >= comparison operators
This adds the LESS_EQUAL, GREATER_EQUAL, and associated STR and VERSION
equivalents to use the combined <= and >= functionality.
2016-08-09 09:30:34 -04:00
Daniel Pfeifer 7a649111cd Use string(APPEND) in Tests
Automate with:

find Tests -type f -print0 | xargs -0 perl -i -0pe \
's/set\(([a-zA-Z0-9_]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
2016-07-28 00:43:04 +02:00
Brad King 353222262a CMakeParseImplicitLinkInfo: Exclude libclang_rt libraries
These libraries are used for Clang runtime analysis support with
flags like `-fsanitize=memory` and are not actually implicitly
linked libraries.

Fixes #16194.
2016-07-11 16:30:02 -04:00
Jean-Christophe Fillion-Robin fad5d59cf4 PushCheckStateTest: Update test to check CMAKE_EXTRA_INCLUDE_FILES 2016-03-31 11:11:32 -04:00
Jean-Christophe Fillion-Robin a3468b78f2 PushCheckStateTest: Test all variables managed by the module 2016-03-31 10:58:33 -04:00
Jean-Christophe Fillion-Robin 85b2bb6cb4 PushCheckStateTest: Fix syntax warning
This commit fixes the following warning originally introduced in
1325260 (Add macros cmake_push/pop_check_state() as discussed on the list.)

  Argument not separated from preceding token by whitespace.
2016-03-31 10:40:23 -04:00
Jose-Luis Blanco-Claraco 6727270b75 CMake: Extend TIMESTAMP sub-commands with new unix time format specifier
The new `%s` format specifier is substituted by file()/string()
`TIMESTAMP` sub-commands with the number of seconds since unix-epoch
(1970-01-01 00:00:00 UTC).

Co-Author: Nils Gladitz <nilsgladitz@gmail.com>
2016-02-18 10:30:13 -05:00
Brad King 97ffbcd8a4 CMakeParseImplicitLinkInfo: Do not match "VAR=..." as link line (#15737)
When compiling with

  LDFLAGS='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'

the compiler output includes a line like

  COLLECT_GCC_OPTIONS='-specs=/usr/lib/rpm/redhat/redhat-hardened-ld' ...

that our link line regex matches due to an argument ending in "-ld".
Since it is not really the link line no implicit link information is
dectected.  Exclude "VAR=..." lines from consideration as link lines to
fix this.
2015-09-11 13:50:34 -04:00
Brad King e5ca59b456 Tests: Move command failure cases into RunCMake infrastructure
Move failure cases from the CMake.{If,List,While,GetProperty} tests over
to the RunCMake.{if,list,while,get_property} tests to use the more
modern infrastructure.  This also avoids using REGEX_ESCAPE_STRING to
try to regex-match full paths.
2015-07-14 10:25:38 -04:00
Brad King 332ee3e305 Tests: Fix CheckSourceTree test when build is under source (#15566)
Since the build tree will populate content under the source tree
the test cannot reliably check that the source tree is pristine.
Simply skip most of the test in this case.
2015-05-14 09:50:34 -04:00
Bill Newcomb a293dcb561 Tests: Fix CMake.ELF test with read-only source (#15489)
When the cmake sources are all set to read-only (e.g. after importing
into perforce), the CMake.ELF test fails because the copy of the binary
is also read-only and cannot be modified.  Fix this by copying the
binary without source permissions.
2015-04-01 16:34:04 -04:00
Brad King 024e25e485 Tests: Add more signature tests to RunCMake.configure_file test
Move the test cases from Tests/CMakeTests/ConfigureFileTest.cmake.in
over to use the RunCMake.configure_file infrastructure.  This does much
more robust verification of CMake output for each test case, and would
have caught the regression fixed in our parent commit.
2015-03-09 09:17:59 -04:00
Brad King 2a3e263173 Tests: Fix CheckSourceTree test for newer Git
The output of 'git status' no longer starts each line in '#'.
Match that optionally.
2014-12-16 14:51:06 -05:00
Domen Vrankar 474bbb9dbc string: Tolerate SUBSTRING length exceeding end index
string SUBSTRING command now ignores length if it points
past end of string and uses end of string instead.
String SUBSTRING tests now cover more corner cases.
2014-11-13 11:04:52 -05:00
Rolf Eike Beer ef09df646a cmSystemTools: reimplement verson comparison without sscanf()
This now has the advantage that it works with version strings with any number
of components.
2014-10-31 11:31:31 -04:00
Rolf Eike Beer 667560c88a extend the testing for version comparison
This now checks also the negative outcome of the comparision operation, and
adds a bunch more different cases.
2014-10-29 21:28:33 +01:00
Rolf Eike Beer 5bd48ac534 Replace string(REGEX REPLACE) with string(REPLACE) where possible
The simple replacement is much faster.
2014-04-14 18:17:05 +02:00
Rolf Eike Beer 2622bc3f65 Clean up usage of if(... MATCHES regex) followed string(REGEX REPLACE regex)
The matches have already been calculated and can simply be taken from
CMAKE_MATCH_n variables. This avoids multiple compilations of the same or very
similar regular expressions.
2014-04-14 18:16:58 +02:00
Matt McCormick 1cb9ef8173 file DOWNLOAD: Test non-zero return status. 2014-01-15 19:43:25 -05:00
Matt McCormick f73f0fb357 file DOWNLOAD: Add test for bad hash. 2014-01-15 19:43:23 -05:00
Daniele E. Domenichelli 15610bb5b1 Drop use of configure_file IMMEDIATE option
Since commit 7d47c693 (Drop compatibility with CMake < 2.4, 2013-10-08)
we no longer need to use the configure_file IMMEDIATE option to support
compatibility modes less than 2.0.
2013-11-13 10:12:17 -05:00
Brad King 6035c0458e get_property: Drop test for builtin property documentation
Property documentation is no longer builtin, so the get_property command
will be unable to return the documentation.  Drop the test for it.
2013-10-16 09:22:36 -04:00
David Cole b494722642 Tests: Verify policies are introduced only in "official" versions
Add the CMake.PolicyCheck test.

This test uses "git grep" to look for policies added in a "dated"
version of CMake. It will fail if a policy is added as of,
for example, CMake 2.8.11.20130828.

The intent is to prevent such constructs from making it into an
"official" release. Three instances actually appeared in the first
attempted release candidate for 2.8.12.

This test may sometimes yield false positives. After all, it's just
using a regular expression to detect this condition, and something
in a comment could possibly match it. As of right now, that's not
true, but it's easy to imagine such a comment being added.

The new test may also not catch all future problems of this sort.
However, it will catch problems of this sort for all code that follows
the present layout style in Source/cmPolicies.cxx.
2013-08-28 17:22:49 -04:00
Nils Gladitz bb71a3a0df Add cmake_host_system_information command
Expose the internal system information API to the CMake language.  For
example, it is useful to see how much memory the system has available to
estimate an upper limit of tests that can run in parallel.
2013-06-19 08:46:37 -04:00
Rolf Eike Beer e4e09212c5 Merge branch 'master' into escape-regex-specials-in-path
Resolve conflicts in Tests/CTestTestMemcheck/CMakeLists.txt by combining
changes from both sides.
2013-06-03 13:43:52 -04:00
Modestas Vainius c9b75dcd73 Fix test failures caused by regexp-sensitive characters in the build paths
Checkout [1] as an example of the test failures. In that particular cases, the
failures is caused by the plus sign in the path being pass unescaped
(buildd-cmake_2.8.9-1~bpo60+1-armel-3Lvkef) to the regexp.

In addition to failures in the log, the following new tests also fail in 2.8.11:

  243 - CTestTestMemcheckUnknown (Failed)
  244 - CTestTestMemcheckUnknownQuoted (Failed)
  248 - CTestTestMemcheckDummyValgrindFailPre (Failed)
  249 - CTestTestMemcheckDummyValgrindFailPost (Failed)
  250 - CTestTestMemcheckDummyPurify (Failed)
  251 - CTestTestMemcheckDummyBC (Failed)
  253 - CMake.List (Failed)

[1] https://buildd.debian.org/status/fetch.php?pkg=cmake&arch=armel&ver=2.8.9-1~bpo60%2B1&stamp=1369243896
2013-06-03 16:51:21 +02:00
Brad King ffda082e65 Sanitize linker name to parse implicit link line (#14154)
Teach CMakeParseImplicitLinkInfo to convert the CMAKE_LINKER file name
to a regular expression that matches only the original name.  Escape
special characters like '+' so they are not treated as regex syntax.
Extend the ImplicitLinkInfoTest to test handling of a CMAKE_LINKER value
with many special characters.
2013-05-17 08:47:35 -04:00
Brad King 98cca40d9b Merge topic 'implicit-lib-canonical-path'
10e8b2d Normalize full paths in implicit link library list
2013-02-08 13:38:10 -05:00
Brad King 10e8b2da37 Normalize full paths in implicit link library list
Teach CMakeParseImplicitLinkInfo to convert implicit link library full
paths to a canonical form.  This makes them more reproducible in case
different language compiler front-ends add the same library by different
paths e.g. ".../libA.a" and "...//libA.a".

Add a case to the CMake.ImplicitLinkInfo test to cover removal of extra
slashes from both library and directory paths.
2013-02-06 16:22:02 -05:00
Rolf Eike Beer 4d0e2e81e9 ProcessorCount test: require SystemInformation process to work
Currently this silently fails on some systems. Make sure those things get
noticed so we can fix that.
2013-01-25 00:31:41 +01:00
Rolf Eike Beer e03f83f394 ProcessorCount test: fix path to cmsysTestsCxx executable
Use a generator expression to get the real place of this target instead of
guessing it wrong.
2013-01-25 00:31:41 +01:00
Brad King cc676c3a08 OS X: Detect implicit linker framework search paths
Previously we hard-coded a list of implicit framework directories but
did not account for CMAKE_OSX_SYSROOT or for changes to the list across
OS X versions.  Instead we should automatically detect the framework
directories for the active toolchain.

The parent commit added the "-Wl,-v" option to ask "ld" to print its
implicit directories.  It displays a block such as:

 Framework search paths:
	/...

Parse this block to extract the list of framework directories.

Detection may fail on toolchains that do not list their framework
directories, such as older OS X linkers.  Always treat the paths

 <sdk>/Library/Frameworks
 <sdk>/System/Library/Frameworks
 <sdk>/Network/Library/Frameworks # Older OS X only
 /System/Library/Frameworks

as implicit.  Note that /System/Library/Frameworks should always be
considered implicit so that frameworks CMake finds there will not
override the SDK copies.
2012-12-11 15:15:52 -05:00
Brad King 2dd67c7ea0 OS X: Detect implicit link directories on modern toolchains
We detect the implicit link directories for the toolchain by adding a
flag to get verbose output from the compiler front-end while linking the
ABI detection binary.  Newer OS X toolchains based on Clang do not add
the implicit link directories with -L options to their internal
invocation of "ld".  Instead they use a linker that comes with the
toolchain and is already configured with the proper directories.

Add the "-Wl,-v" option to ask "ld" to print its implicit directories.
It displays them in a block such as:

 Library search paths:
	/...

Parse this block to extract the implicit link directories.

While at it, remove the checks introduced by commit efaf335b (Skip
implicit link information on Xcode, 2009-07-23) and commit 5195a664
(Skip implicit link info for multiple OS X archs, 2009-09-22).  Discard
the non-system link directories added by Xcode.  Discard all detected
implicit libraries in the multi-architecture case but keep the
directories.  The directories are still useful without the libraries
just to suppress addition of explicit -L options for them.
2012-12-11 15:15:51 -05:00
David Cole d842d90622 CMake: Stylistic changes and documentation tweaks
...for the contributed file and string TIMESTAMP sub-commands.
2012-12-05 10:39:11 -05:00
Nils Gladitz 711e2b3b5c CMake: Add TIMESTAMP subcommand to string and file commands 2012-12-05 10:39:10 -05:00
Petr Kmoch 828d4f514d Add several get_property() tests
Add tests for some get_property() uses not covered by existing tests.
2012-11-02 17:10:07 +01:00
Rolf Eike Beer 82106e3783 GetProperty test: move doc property tests into main process
They will not raise an error in the normal case so we do not need to run them
in their own process.
2012-11-02 17:10:07 +01:00
Rolf Eike Beer 56125a3f36 list: add tests for CMP0007 behavior 2012-11-02 17:10:07 +01:00
Amine Chadly 48ed48f7ad Add test to secure the file(GLOB empty) behavior. 2012-11-02 17:10:06 +01:00
Amine Chadly c2a6cb64af file: remove dead code
The file command requires at least two arguments, so guarding the GLOB and
MAKE_DIRECTORY command is not necessary. Changed it for an assert to keep the
protection.
2012-11-02 17:10:06 +01:00
Petr Kmoch 07251a8ea5 Consolidate list() argument count testing
Move test for list() argument count >= 2 to InitialPass().
2012-11-02 17:09:55 +01:00
Petr Kmoch 1b078c304d Add tests for list() invalid arguments
Add tests for error reporting when list() arguments are invalid.
2012-11-02 17:08:49 +01:00
Petr Kmoch f560977540 Add tests for list() argument count
Add test for error reporting when list() subcommands have wrong number of
arguments.
2012-11-02 17:08:44 +01:00
Rolf Eike Beer d211e5d203 CMakeTests: allow to call the check_cmake_test macro with a given file
This allows to generate a lot of simple files directly in the test tree instead
of having them all checked in.
2012-11-02 12:50:05 +01:00
Brad King 95a0011604 file(DOWNLOAD): Change EXPECTED_HASH to take ALGO=value
Make the EXPECTED_HASH option take only a single value instead of two to
avoid handling sub-keyword arguments.  This is also consistent with
URL_HASH in ExternalProject.
2012-09-19 11:31:36 -04:00
David Cole 3e7fe5a7a0 Merge topic 'if-version-depth'
dfa0ebd if: Compare up to 8 components in VERSION tests
2012-09-18 16:41:59 -04:00
Brad King dfa0ebd646 if: Compare up to 8 components in VERSION tests
Extend the number of components tested by

  if(... VERSION_LESS ...)
  if(... VERSION_EQUAL ...)
  if(... VERSION_GREATER ...)

from 4 to 8.  The latter is a more extreme maximum.
2012-09-11 15:59:16 -04:00
Bill Hoffman 34567dfc0d file(DOWNLOAD): Generalize EXPECTED_MD5 to EXPECTED_HASH
Add support for SHA algorithms.
2012-09-11 08:58:29 -04:00