summaryrefslogtreecommitdiff
path: root/test/Libs
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2008-02-04 19:07:24 +0000
committerSteven Knight <knight@baldmt.com>2008-02-04 19:07:24 +0000
commit6c9d9f00b4014222dc59c639b5aedb76ae34fe38 (patch)
tree439714b7733dd4ffe858b1fc15e15fa3e036048d /test/Libs
parentf6338aad9f11469707c61b156639b209c143d9c4 (diff)
downloadscons-6c9d9f00b4014222dc59c639b5aedb76ae34fe38.tar.gz
Merged revisions 2527-2645 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core ........ r2528 | stevenknight | 2007-12-13 06:08:21 -0800 (Thu, 13 Dec 2007) | 5 lines Remove the .del_binfo() method, no longer needed since the Big Signature Refactoring causes us to visit every Node in order during the DAG walk, and the BuildInfo object now just holds information for storage in the .sconsign file. ........ r2529 | stevenknight | 2007-12-13 13:17:15 -0800 (Thu, 13 Dec 2007) | 3 lines Fix the --keep-going flag so it builds all possible targets even when a later top-level target depends on a child that failed its build. ........ r2530 | stevenknight | 2007-12-14 04:02:05 -0800 (Fri, 14 Dec 2007) | 4 lines Issue 1715: BuildDir(duplicate=0) support for Tex/LaTeX. Re-run LaTeX in response to package warnings. (Rob Managan) ........ r2531 | stevenknight | 2007-12-14 07:14:31 -0800 (Fri, 14 Dec 2007) | 3 lines Refactor the max_drift logic around fetching stored signatures into its own new method. ........ r2532 | stevenknight | 2007-12-14 07:18:44 -0800 (Fri, 14 Dec 2007) | 3 lines Have get_csig() return the stored content signature if max_drift says it's okay. ........ r2533 | stevenknight | 2007-12-14 18:34:51 -0800 (Fri, 14 Dec 2007) | 2 lines Issue 1859: Support SWIG statements like %module(directors="1"). ........ r2534 | stevenknight | 2007-12-15 03:51:13 -0800 (Sat, 15 Dec 2007) | 3 lines Python 2.1 portability fix w.r.t. "import SCons" and "import SCons.platform.win32" and binding local variables and whatnot. ........ r2535 | stevenknight | 2007-12-15 03:51:56 -0800 (Sat, 15 Dec 2007) | 2 lines Python 1.5 fix: use the -classic flag when invoking SWIG. ........ r2536 | stevenknight | 2007-12-15 06:03:48 -0800 (Sat, 15 Dec 2007) | 4 lines Support subclasses of the new-style str() class as input to Builders and the like. Also speed up all of the Util.is_*() functions when using new-style classes by just using isinstance() internally. ........ r2537 | stevenknight | 2007-12-15 06:35:49 -0800 (Sat, 15 Dec 2007) | 3 lines Issue 1851: Fix being able to use $PDB and $WINDOWS_INSERT_MANIFEST together. (Benoit Belley) ........ r2538 | stevenknight | 2007-12-15 06:59:43 -0800 (Sat, 15 Dec 2007) | 3 lines Handle dangling entries for the Intel C compiler in the Windows registry. (Benoit Belley) ........ r2539 | stevenknight | 2007-12-15 09:51:59 -0800 (Sat, 15 Dec 2007) | 2 lines Reorganize library-related tests into a separate subdirectory. ........ r2540 | stevenknight | 2007-12-15 09:57:29 -0800 (Sat, 15 Dec 2007) | 4 lines Issue 1850: better support for non-standard shared library prefixes and suffixes by stripping all prefixes and suffixes in lists of $SHLIBPREFIXES and $SHLIBSUFFIXES. (Benoit Belley) ........ r2541 | stevenknight | 2007-12-15 18:49:15 -0800 (Sat, 15 Dec 2007) | 2 lines Python 1.5 portability fixes. ........ r2542 | stevenknight | 2007-12-15 19:02:39 -0800 (Sat, 15 Dec 2007) | 3 lines Issue 1768: Have the D language scanner search for .di files as well as .d files. (Jerome Berger) ........ r2543 | stevenknight | 2007-12-16 14:31:40 -0800 (Sun, 16 Dec 2007) | 3 lines Add a find_include_names() method to the Scanner.Classic class to abstract out how included names can be generated by subclasses. (Jerome Berger) ........ r2544 | stevenknight | 2007-12-16 14:31:54 -0800 (Sun, 16 Dec 2007) | 3 lines Add a find_include_names() method to the Scanner.Classic class to abstract out how included names can be generated by subclasses. (Jerome Berger) ........ r2545 | stevenknight | 2007-12-16 15:04:43 -0800 (Sun, 16 Dec 2007) | 3 lines Issue 1860: Support the D scanner returning multiple modules from a single import statement. (Jerome Berger) ........ r2546 | stevenknight | 2007-12-16 17:41:17 -0800 (Sun, 16 Dec 2007) | 3 lines Issue 1861: Fix the ability to #include a file (or search other $*PATH variables) that has an absoluate path. ........ r2547 | stevenknight | 2007-12-18 08:09:59 -0800 (Tue, 18 Dec 2007) | 2 lines Replace uses of "is_List() or is_Tuple()" with is_Sequence(). ........ r2548 | stevenknight | 2007-12-18 08:13:14 -0800 (Tue, 18 Dec 2007) | 2 lines Report the incorrect value in assertions. ........ r2549 | stevenknight | 2007-12-19 07:58:56 -0800 (Wed, 19 Dec 2007) | 3 lines Fix handling #includes of absolute path names when the path doesn't exist (implicitly, because it's #ifdef'ed out). ........ r2550 | stevenknight | 2007-12-19 08:29:24 -0800 (Wed, 19 Dec 2007) | 4 lines Fix test path examination when the temporary directory location is redirected via symlinks (e.g. /usr/tmp -> /var/tmp on Red Hat). (Benoit Belley) ........ r2551 | stevenknight | 2007-12-19 08:30:17 -0800 (Wed, 19 Dec 2007) | 2 lines Fix scons-time path reporting when symlinks are involved. (Benoit Belley) ........ r2552 | stevenknight | 2007-12-19 22:51:18 -0800 (Wed, 19 Dec 2007) | 4 lines Issue 1855: Reduce the worker thread stack size to a default of 256 Kbytes. Add a --stack-size= command-line option, also configurable via SetOption('stack_size'). (Benoit Belley) ........ r2553 | stevenknight | 2007-12-20 18:25:50 -0800 (Thu, 20 Dec 2007) | 2 lines Skip this test if SWIG isn't installed. ........ r2554 | stevenknight | 2007-12-20 18:26:21 -0800 (Thu, 20 Dec 2007) | 2 lines Accomodate slightly different permissions errors on Ubuntu Gutsy. ........ r2555 | stevenknight | 2007-12-21 02:12:09 -0800 (Fri, 21 Dec 2007) | 3 lines Fix a Python 2.2 quirk in the reported file name ("<string>") when encountering a SyntaxError in a SConstruct file. ........ r2556 | stevenknight | 2007-12-21 02:12:35 -0800 (Fri, 21 Dec 2007) | 2 lines Enforce order between the build of f1.out and f2.out. ........ r2557 | stevenknight | 2007-12-21 02:12:55 -0800 (Fri, 21 Dec 2007) | 2 lines Don't die if the Python version doesn't have os.path.realpath(). ........ r2558 | stevenknight | 2007-12-21 02:13:19 -0800 (Fri, 21 Dec 2007) | 2 lines Refactor the test/build-errors.py script into separate scripts for each test. ........ r2559 | stevenknight | 2007-12-21 08:08:12 -0800 (Fri, 21 Dec 2007) | 3 lines Issue 1864: Add a CheckDeclaration() call to configure contexts. (David Cournapeau) ........ r2560 | stevenknight | 2007-12-21 08:18:47 -0800 (Fri, 21 Dec 2007) | 2 lines Issue 1865: Improve the CheckTypeSize() code. (David Cournapeau) ........ r2561 | stevenknight | 2007-12-21 08:21:47 -0800 (Fri, 21 Dec 2007) | 2 lines Fix os.path.realpath() handling (a Python 2.1 portability issue). ........ r2562 | stevenknight | 2007-12-21 14:08:39 -0800 (Fri, 21 Dec 2007) | 2 lines Split CPPDEFINES.py into separate sub-test scripts. ........ r2563 | stevenknight | 2007-12-21 15:56:26 -0800 (Fri, 21 Dec 2007) | 6 lines Support proper expansion of construction variables containing lists within expansions like $CPPPATH. Change env.subst() to return a list, not a joined string, when the input is a list. (Konstantin Bozhikov) ........ r2564 | stevenknight | 2007-12-22 04:15:11 -0800 (Sat, 22 Dec 2007) | 2 lines Normalize the ModDate field when comparing generated PDF files. ........ r2565 | stevenknight | 2007-12-22 22:01:45 -0800 (Sat, 22 Dec 2007) | 5 lines Java test refactoring to commonize construction environment initialization and searching for javac / javah / jar / rmic. Don't look for *_Skel.class files to be created by Java 1.[56]. Minor Java code changes to deal with compiler warnings. ........ r2566 | stevenknight | 2007-12-23 05:20:45 -0800 (Sun, 23 Dec 2007) | 2 lines Don't still look for *_Skel.class files. ........ r2567 | stevenknight | 2007-12-23 07:30:36 -0800 (Sun, 23 Dec 2007) | 5 lines Fix Intel C compiler issues: Issue 1863: Fix failure to match /opt/intel_cc_* directories. (Benoit Belley) Issue 1866: Fix topdir when the version isn't specified. (Jonas Olsson) Issue 1867: Fix use of network licenses. (Jonas Olsson) ........ r2573 | stevenknight | 2008-01-01 09:59:16 -0800 (Tue, 01 Jan 2008) | 3 lines Add asynchronous subprocess communication via new start() and finish() methods. ........ r2574 | stevenknight | 2008-01-01 10:02:26 -0800 (Tue, 01 Jan 2008) | 4 lines Minor code cleanup: attach the version string to the options parser object, instead of passing it in to deal with the lack of nested scopes in Python 1.5.2. ........ r2575 | stevenknight | 2008-01-01 10:08:46 -0800 (Tue, 01 Jan 2008) | 4 lines Rename the CacheDir class and let the name CacheDir be a variable that can be reset at will, depending on whether CacheDir() support is enabled or disabled at any particular time. ........ r2576 | stevenknight | 2008-01-01 10:14:58 -0800 (Tue, 01 Jan 2008) | 2 lines Restore the Node.del_binfo() method and its call in Node.clear(). ........ r2577 | stevenknight | 2008-01-02 07:51:25 -0800 (Wed, 02 Jan 2008) | 6 lines Refactor CacheDir support (again) for --interactive mode. Delay effects of --cache-* settings until they're needed by getting rid of the Null() object pattern and the functional programming idiom of replacing the CacheDebug method. Have the Environment.CacheDir() method just record the path for later instantiation. ........ r2578 | stevenknight | 2008-01-02 18:48:12 -0800 (Wed, 02 Jan 2008) | 3 lines Issue 1657: Add a --interactive option to create a command-line interpreter for re-building targets without re-reading SConscript files. ........ r2579 | stevenknight | 2008-01-02 21:54:38 -0800 (Wed, 02 Jan 2008) | 2 lines Python 1.5.2 portability fix (no use of +=). ........ r2580 | stevenknight | 2008-01-02 21:54:47 -0800 (Wed, 02 Jan 2008) | 3 lines Use a regular expression to avoid having to match a specific MD5 checksum value in the --cache-debug output. ........ r2581 | stevenknight | 2008-01-02 21:54:59 -0800 (Wed, 02 Jan 2008) | 4 lines Don't bother looking for shlex.split(), since our compatibility layer provides it in older Python version. Make the compatibility version of shlex.split() not treat '.' as a token separator. ........ r2582 | stevenknight | 2008-01-02 21:56:15 -0800 (Wed, 02 Jan 2008) | 3 lines Python 1.5.2 portability fixes: no list comprehensions, no nested scopes, no "for x in" a dictionary. ........ r2583 | stevenknight | 2008-01-03 07:39:59 -0800 (Thu, 03 Jan 2008) | 3 lines Fix a left-over use of a string method. Fix printing --interactive help text, which I outright broke last checkin. ........ r2584 | stevenknight | 2008-01-03 07:58:56 -0800 (Thu, 03 Jan 2008) | 4 lines Import the vanilla Python2.5 shlex module, which we'll use as a basis for retrofitting to old Python versions to provide shlex.split() functionality. ........ r2585 | stevenknight | 2008-01-03 08:01:02 -0800 (Thu, 03 Jan 2008) | 3 lines Modifications to the vanilla Python 2.5 shlex module to make it work back to Python 1.5. ........ r2586 | stevenknight | 2008-01-03 08:04:31 -0800 (Thu, 03 Jan 2008) | 3 lines Use the new shlex compatibility module if we're using an old version of Python with a native shlex module that has no shlex.split() function. ........ r2587 | stevenknight | 2008-01-03 09:31:15 -0800 (Thu, 03 Jan 2008) | 3 lines Fix the ParseFlags() unit test now that we have a real shlex.split() function even on earlier Python versions. ........ r2588 | stevenknight | 2008-01-06 04:52:05 -0800 (Sun, 06 Jan 2008) | 3 lines Add compat/_scons_shlex.py to exception lists for __copyright__ and __revision__ strings. ........ r2589 | stevenknight | 2008-01-06 06:32:07 -0800 (Sun, 06 Jan 2008) | 2 lines Remove leftover debug print. ........ r2590 | stevenknight | 2008-01-06 07:35:46 -0800 (Sun, 06 Jan 2008) | 3 lines Change the test to work by wrapping the public .__call__() method of the C scanner, instead of the internal .scan() method. ........ r2591 | stevenknight | 2008-01-06 07:39:12 -0800 (Sun, 06 Jan 2008) | 3 lines Use the public CScan.path() method, not the internal CScan.path_function attribute. ........ r2592 | stevenknight | 2008-01-07 02:55:53 -0800 (Mon, 07 Jan 2008) | 2 lines Use a tuple instead of a list for the cpp module path(s). ........ r2593 | stevenknight | 2008-01-07 03:10:28 -0800 (Mon, 07 Jan 2008) | 2 lines Don't die if a macro function expands to a non-string (an integer). ........ r2594 | stevenknight | 2008-01-07 03:29:12 -0800 (Mon, 07 Jan 2008) | 3 lines Python 1.5 throws TypeError, not AttributeError if you try to string.split() a non-string value. ........ r2595 | stevenknight | 2008-01-07 03:30:18 -0800 (Mon, 07 Jan 2008) | 3 lines Reduce duplicate execution of individual test_*() unit test methods by eliminating duplicates (if the set() type is avaiable). ........ r2596 | stevenknight | 2008-01-07 06:57:30 -0800 (Mon, 07 Jan 2008) | 6 lines Add a basic test of in-line #include handling. Sort the test names. Don't os.path.join() the directory name if we find the file in the current directory. Use os.curdir instead of hard-coding '.' as the current directory. ........ r2597 | stevenknight | 2008-01-07 06:59:29 -0800 (Mon, 07 Jan 2008) | 3 lines Read files with a new .read_file() method, so it can be overridden by subclasses. ........ r2598 | stevenknight | 2008-01-07 17:59:50 -0800 (Mon, 07 Jan 2008) | 6 lines Record the name of the file currently being processed. Make the public API (the .__call__() method) passing in a file name to be opened, and have it call a new, separate .process_contents() method (the old .__call__() method) for handling in-memory strings. ........ r2599 | stevenknight | 2008-01-07 20:03:18 -0800 (Mon, 07 Jan 2008) | 3 lines Make the test failure informative when we don't find the includes we expect by printing the expected string and actual output. ........ r2600 | stevenknight | 2008-01-07 20:24:21 -0800 (Mon, 07 Jan 2008) | 2 lines Handle no white space after #include (e.g. #include<foo.h>). ........ r2601 | stevenknight | 2008-01-07 21:01:27 -0800 (Mon, 07 Jan 2008) | 4 lines Fixes for older Python versions: No tempfile.mktemp(prefix=) argument. No string methods. ........ r2602 | stevenknight | 2008-01-08 20:57:30 -0800 (Tue, 08 Jan 2008) | 3 lines Fix command-line editing of --interactive mode with the readline module by only changing sys.stdout to our Unbuffered class if it isn't a tty. ........ r2603 | stevenknight | 2008-01-08 22:12:20 -0800 (Tue, 08 Jan 2008) | 4 lines Fix the --interactive "build" command with no targets: build the specified Default() targets; issue an error message but don't exit if Default(None) is explicity specified. ........ r2604 | stevenknight | 2008-01-09 05:00:36 -0800 (Wed, 09 Jan 2008) | 9 lines Improve Python functions used as actions by incorporating into their build signatures: - literal values referenced by the byte code. - values of default arguments - code of nested functions - values of variables captured by closures - names of referenced global variables and functions (Benoit Belley) ........ r2605 | stevenknight | 2008-01-09 06:39:03 -0800 (Wed, 09 Jan 2008) | 4 lines Add a Configure.Define() method for adding arbitrary #define lines to generated configure header files. (David Cournapeau) ........ r2606 | stevenknight | 2008-01-09 07:33:21 -0800 (Wed, 09 Jan 2008) | 4 lines Issue 1858: Fix the closing message when --clean and --keep-going are both used so it only reports errors if some actually occurred. (Benoit Belley) ........ r2607 | stevenknight | 2008-01-09 07:51:55 -0800 (Wed, 09 Jan 2008) | 3 lines Issue 1843: Add a gfortran Tool module for the GNU F95/F2003 compiler. (David Cournapeau) ........ r2608 | stevenknight | 2008-01-09 09:31:15 -0800 (Wed, 09 Jan 2008) | 4 lines Issue 1733: If $JARCHDIR isn't set explicitly, use the .java_classdir attribute that was set when the Java() Builder built the .class files. (Jan Nijtmans) ........ r2609 | stevenknight | 2008-01-09 11:27:28 -0800 (Wed, 09 Jan 2008) | 4 lines Allow Scanner.FindPathDirs objects to not take a dir= keyword argument when called. (The code already detects that and uses the current directory if necessary.) ........ r2610 | stevenknight | 2008-01-09 12:23:26 -0800 (Wed, 09 Jan 2008) | 3 lines Allow subclass overrides of results-handling by the addition of new initialize_result() and finalize_result() methods. ........ r2611 | stevenknight | 2008-01-09 14:49:50 -0800 (Wed, 09 Jan 2008) | 6 lines Capture new C Scanner glue code that knows how to use $CPPDEFINES to evaluate CPP #if/#ifdef/#elif/#else lines. Currently disabled (including the test script that validates the behavior) while we look for the right way to let users configure the feature, and work on performance issues with its O(N*M) algorithm. ........ r2612 | stevenknight | 2008-01-24 20:42:57 -0800 (Thu, 24 Jan 2008) | 3 lines Fix regular expression comparisons on Windows by escaping the \ path separators. ........ r2613 | stevenknight | 2008-01-24 20:49:04 -0800 (Thu, 24 Jan 2008) | 3 lines Rename a created stub script from "cmd.py" so it doesn't mistakenly get imported by the "import cmd" statement in Script/Interactive.py. ........ r2614 | stevenknight | 2008-01-24 20:56:05 -0800 (Thu, 24 Jan 2008) | 4 lines Fix a race condition between the actions executed by the worker threads by having the dependent action print its own execution line, and telling SCons to treat it silently (strfunction=None). ........ r2615 | stevenknight | 2008-01-24 20:59:03 -0800 (Thu, 24 Jan 2008) | 2 lines Remove left-over commented-out lines. ........ r2616 | stevenknight | 2008-01-24 21:59:49 -0800 (Thu, 24 Jan 2008) | 7 lines Windows portability in --interactive mode and its tests: Quote target names that may have spaces in them. Use the .exe suffix on a generated executable. Use the subprocess .wait() method to get the subprocess exit status when shelling out on Windows. Use an Unbuffered object for stderr (when it's not a tty). ........ r2617 | stevenknight | 2008-01-24 22:14:49 -0800 (Thu, 24 Jan 2008) | 3 lines Issue 1886: Fix the ability to build Aliases in --interactive mode. (Gary Oberbrunner) ........ r2618 | stevenknight | 2008-01-24 22:33:29 -0800 (Thu, 24 Jan 2008) | 3 lines Issue 1886: Handle Python versions that throw TypeError when they can't pickle a nested function. (Gary Oberbrunner) ........ r2619 | stevenknight | 2008-01-24 22:38:44 -0800 (Thu, 24 Jan 2008) | 3 lines Fix the LoadableModule.py test when run on Intel Macs (look for the string i386 in the file output, in addition to ppc). ........ r2620 | stevenknight | 2008-01-25 06:50:43 -0800 (Fri, 25 Jan 2008) | 4 lines Issue 1892: use "link" instead of "gnulink" for the Mac tool chain, since it doesn't understand the -rpath option and can't use $RPATH. (David Cournapeau) ........ r2621 | stevenknight | 2008-01-25 07:51:56 -0800 (Fri, 25 Jan 2008) | 2 lines Issue 1893: add Intel C compiler support on Mac OS X. (Benoit Belley) ........ r2622 | stevenknight | 2008-01-25 21:48:16 -0800 (Fri, 25 Jan 2008) | 2 lines Fix how we handle falling back to timestamps when no md5.py module exists. ........ r2623 | stevenknight | 2008-01-26 16:55:56 -0800 (Sat, 26 Jan 2008) | 5 lines Work around a metaclass / new.instancemethod() bug in base Python 2.2 by disallowing --debug=memoizer functionality if Python can't handle the Memoizer initialization (much like we do for earlier Python versions that don't have metaclasses at all). ........ r2624 | stevenknight | 2008-01-26 18:22:14 -0800 (Sat, 26 Jan 2008) | 4 lines Fix CacheDir by simplifying how the NullEnvironment hands back something that looks enough like a CacheDir object that the rest of the code doesn't require special handling. ........ r2625 | stevenknight | 2008-01-26 20:56:17 -0800 (Sat, 26 Jan 2008) | 2 lines Have the "scons-time time" subcommand handle empty files gracefully. ........ r2626 | stevenknight | 2008-01-26 20:57:21 -0800 (Sat, 26 Jan 2008) | 3 lines Add a Trace() statement to the Node.changed() method if the dependency lists are different lengths. ........ r2627 | stevenknight | 2008-01-26 21:30:59 -0800 (Sat, 26 Jan 2008) | 3 lines Have the "scons-time time --which" subcommand handle files that don't contain the requested results ........ r2628 | stevenknight | 2008-01-26 21:52:51 -0800 (Sat, 26 Jan 2008) | 2 lines Fix the ability to draw vertical bars with --fmt gnuplot option. ........ r2629 | stevenknight | 2008-01-26 22:23:10 -0800 (Sat, 26 Jan 2008) | 3 lines Allow "scons-time run" to copy non-archive files for timing. Document the archive_list config file variable. ........ r2630 | stevenknight | 2008-01-27 10:38:11 -0800 (Sun, 27 Jan 2008) | 3 lines Use the maximum Y value, not the maximum X value, as the top Y endpoint of a vertical bar drawn with --fmt=gnuplot. ........ r2631 | stevenknight | 2008-01-27 12:05:40 -0800 (Sun, 27 Jan 2008) | 2 lines Make scons-time more robust when handling log files that have no results. ........ r2632 | stevenknight | 2008-01-27 12:49:02 -0800 (Sun, 27 Jan 2008) | 2 lines Rotate label positions so they don't overwrite each other. ........ r2633 | stevenknight | 2008-01-27 16:21:17 -0800 (Sun, 27 Jan 2008) | 2 lines Extend vertical bars to graph top, not maximum X value. ........ r2634 | stevenknight | 2008-01-27 18:08:19 -0800 (Sun, 27 Jan 2008) | 2 lines Capture three configurations for timing various aspects of SCons. ........ r2635 | stevenknight | 2008-01-28 04:55:12 -0800 (Mon, 28 Jan 2008) | 2 lines Fix jar calls to use "tf" instead of "-t -f" for compatibility with Sun. ........ r2636 | stevenknight | 2008-01-28 12:49:58 -0800 (Mon, 28 Jan 2008) | 6 lines Refactor cut-and-paste tempdir_re() function into a common method in QMTest/TestSCons_time.py. In the refactored code, fix typo of os.path.relpath() where we meant os.path.realpath(), so we follow the /tmp -> /private/tmp symlink on Mac OS X. ........ r2637 | stevenknight | 2008-01-28 15:18:14 -0800 (Mon, 28 Jan 2008) | 5 lines Apple portability in the test for explicit "No such file" error messages from trying to fork()/exec() a non-existent file name. Refactor the tests for (non-)expected output in stderr so they're informative if they fail. ........ r2638 | stevenknight | 2008-01-28 17:54:29 -0800 (Mon, 28 Jan 2008) | 3 lines Make the test output deterministic by making the InstallAs() targets (file[23].out) depend on the Install() target (file1.out). ........ r2639 | stevenknight | 2008-01-28 21:37:38 -0800 (Mon, 28 Jan 2008) | 4 lines On Mac OS X, add -w to LINKFLAGS to suppress warnings about the directories we specify as -L arguments which don't actually exist. We just want to make sure that the right directory names show up. ........ r2640 | stevenknight | 2008-01-28 21:38:36 -0800 (Mon, 28 Jan 2008) | 3 lines On Mac OS X, the generated include file for C++ just tacks ".h" on the end of the generated .cpp file name. Define $YACCHXXFILESUFFIX accordingly. ........ r2641 | stevenknight | 2008-01-29 04:56:18 -0800 (Tue, 29 Jan 2008) | 3 lines Add the src/CHANGES.txt for the previous change (Mac OS X bison behavior). Add a "bison" application entity to the DocBook infrastructure. ........ r2642 | stevenknight | 2008-01-30 05:09:02 -0800 (Wed, 30 Jan 2008) | 5 lines Improve QT tests for Mac OS X: More general regular expression match for a "Generated moc file" warning. Copy libmyqt.dylib to the same directory as the "aaa" executable so it's found when we run it. ........ r2643 | stevenknight | 2008-01-30 05:19:23 -0800 (Wed, 30 Jan 2008) | 2 lines Skip the test of Java handling SWIG dependencies if swig isn't installed. ........ r2644 | stevenknight | 2008-01-30 06:44:30 -0800 (Wed, 30 Jan 2008) | 2 lines Remove left-over print statement. ........ r2645 | stevenknight | 2008-01-30 06:52:54 -0800 (Wed, 30 Jan 2008) | 2 lines Mac OS X fix: use .dylib, not .so, in the list of "weird suffixes" we test. ........
Diffstat (limited to 'test/Libs')
-rw-r--r--test/Libs/LIBPATH.py175
-rw-r--r--test/Libs/LIBPREFIX.py38
-rw-r--r--test/Libs/LIBPREFIXES.py77
-rw-r--r--test/Libs/LIBS.py289
-rw-r--r--test/Libs/LIBSUFFIX.py38
-rw-r--r--test/Libs/LIBSUFFIXES.py77
-rw-r--r--test/Libs/Library.py167
-rw-r--r--test/Libs/SHLIBPREFIX.py53
-rw-r--r--test/Libs/SHLIBSUFFIX.py53
-rw-r--r--test/Libs/SharedLibrary.py285
-rw-r--r--test/Libs/SharedLibraryIxes.py261
11 files changed, 1513 insertions, 0 deletions
diff --git a/test/Libs/LIBPATH.py b/test/Libs/LIBPATH.py
new file mode 100644
index 00000000..7fd4f9bd
--- /dev/null
+++ b/test/Libs/LIBPATH.py
@@ -0,0 +1,175 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+import sys
+import os.path
+import time
+
+_exe = TestSCons._exe
+_dll = TestSCons._dll
+dll_ = TestSCons.dll_
+
+test = TestSCons.TestSCons()
+
+test.subdir('lib1', 'lib2')
+
+prog1 = test.workpath('prog') + _exe
+prog2 = test.workpath(dll_ + 'shlib') + _dll
+
+test.write('SConstruct', """
+env1 = Environment(LIBS = [ 'foo1' ],
+ LIBPATH = [ '$FOO' ],
+ FOO='./lib1')
+
+f1 = env1.SharedObject('f1', 'f1.c')
+
+env1.Program(target = 'prog', source = 'prog.c')
+env1.Library(target = './lib1/foo1', source = f1)
+
+env2 = Environment(LIBS = 'foo2',
+ LIBPATH = '.')
+env2.SharedLibrary(target = 'shlib', source = 'shlib.c', no_import_lib = 1)
+env2.Library(target = 'foo2', source = f1)
+""")
+
+test.write('f1.c', r"""
+#include <stdio.h>
+
+void
+f1(void)
+{
+ printf("f1.c\n");
+}
+""")
+
+test.write('shlib.c', r"""
+void f1(void);
+int
+test()
+{
+ f1();
+ return 0;
+}
+""")
+
+test.write('prog.c', r"""
+#include <stdio.h>
+
+void f1(void);
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ f1();
+ printf("prog.c\n");
+ return 0;
+}
+""")
+
+test.run(arguments = '.',
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+
+test.run(program = prog1,
+ stdout = "f1.c\nprog.c\n")
+
+oldtime1 = os.path.getmtime(prog1)
+oldtime2 = os.path.getmtime(prog2)
+time.sleep(2)
+test.run(arguments = '.')
+
+test.fail_test(oldtime1 != os.path.getmtime(prog1))
+test.fail_test(oldtime2 != os.path.getmtime(prog2))
+
+test.write('f1.c', r"""
+#include <stdio.h>
+
+void
+f1(void)
+{
+ printf("f1.c 1\n");
+}
+""")
+
+test.run(arguments = '.',
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+test.run(program = prog1,
+ stdout = "f1.c 1\nprog.c\n")
+test.fail_test(oldtime2 == os.path.getmtime(prog2))
+#test.up_to_date(arguments = '.')
+# Change LIBPATH and make sure we don't rebuild because of it.
+test.write('SConstruct', """
+env1 = Environment(LIBS = [ 'foo1' ],
+ LIBPATH = [ './lib1', './lib2' ])
+
+f1 = env1.SharedObject('f1', 'f1.c')
+
+env1.Program(target = 'prog', source = 'prog.c')
+env1.Library(target = './lib1/foo1', source = f1)
+
+env2 = Environment(LIBS = 'foo2',
+ LIBPATH = Split('. ./lib2'))
+env2.SharedLibrary(target = 'shlib', source = 'shlib.c', no_import_lib = 1)
+env2.Library(target = 'foo2', source = f1)
+""")
+
+test.up_to_date(arguments = '.', stderr=None)
+
+test.write('f1.c', r"""
+#include <stdio.h>
+
+void
+f1(void)
+{
+ printf("f1.c 2\n");
+}
+""")
+
+test.run(arguments = '.',
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+test.run(program = prog1,
+ stdout = "f1.c 2\nprog.c\n")
+
+test.up_to_date(arguments = '.')
+
+# We need at least one file for some implementations of the Library
+# builder, notably the SGI one.
+test.write('empty.c', 'int a=0;\n')
+
+# Check that a null-string LIBPATH doesn't blow up.
+test.write('SConstruct', """
+env = Environment(LIBPATH = '')
+env.Library('foo', source = 'empty.c')
+""")
+
+test.run(arguments = '.',
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+
+test.pass_test()
diff --git a/test/Libs/LIBPREFIX.py b/test/Libs/LIBPREFIX.py
new file mode 100644
index 00000000..a71e9673
--- /dev/null
+++ b/test/Libs/LIBPREFIX.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test() #XXX Short-circuit until this is implemented.
+
+test.write('SConstruct', """
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()
diff --git a/test/Libs/LIBPREFIXES.py b/test/Libs/LIBPREFIXES.py
new file mode 100644
index 00000000..1e5d6c2b
--- /dev/null
+++ b/test/Libs/LIBPREFIXES.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import sys
+import TestSCons
+
+if sys.platform == 'win32':
+ _lib = '.lib'
+else:
+ _lib = '.a'
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env = Environment(LIBPREFIX = 'xxx-',
+ LIBPREFIXES = ['xxx-'])
+lib = env.Library(target = 'foo', source = 'foo.c')
+env.Program(target = 'prog', source = ['prog.c', lib])
+""")
+
+test.write('foo.c', r"""
+#include <stdio.h>
+
+void
+foo(void)
+{
+ printf("foo.c\n");
+}
+""")
+
+test.write('prog.c', r"""
+#include <stdio.h>
+
+void foo(void);
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ foo();
+ printf("prog.c\n");
+ return 0;
+}
+""")
+
+test.run(arguments = '.',
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+
+test.fail_test(not os.path.exists(test.workpath('xxx-foo' + _lib)))
+
+test.run(program = test.workpath('prog'), stdout = "foo.c\nprog.c\n")
+
+test.pass_test()
diff --git a/test/Libs/LIBS.py b/test/Libs/LIBS.py
new file mode 100644
index 00000000..e9f65451
--- /dev/null
+++ b/test/Libs/LIBS.py
@@ -0,0 +1,289 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+import sys
+
+if sys.platform == 'win32':
+ _exe = '.exe'
+ bar_lib = 'bar.lib'
+else:
+ _exe = ''
+ bar_lib = 'libbar.a'
+
+test = TestSCons.TestSCons()
+
+test.subdir('sub1', 'sub2')
+
+foo1_exe = test.workpath('foo1' + _exe)
+foo2_exe = test.workpath('foo2' + _exe)
+foo3_exe = test.workpath('foo3' + _exe)
+foo4_exe = test.workpath('foo4' + _exe)
+foo5_exe = test.workpath('foo5' + _exe)
+slprog_exe = test.workpath('slprog' + _exe)
+
+test.write('SConstruct', """
+env = Environment(LIBS=['bar'], LIBPATH = '.')
+env.Program(target='foo1', source='foo1.c')
+env2 = Environment(LIBS=[File(r'%s')], LIBPATH = '.')
+env2.Program(target='foo2', source='foo2.c')
+env3 = Environment(LIBS='bar', LIBPATH = '.')
+env3.Program(target='foo3', source='foo3.c')
+env4 = Environment(LIBS=File(r'%s'), LIBPATH = '.')
+env4.Program(target='foo4', source='foo4.c')
+env5 = Environment(LIBS=['bar', '$UNSPECIFIED'], LIBPATH = '.')
+env5.Program(target='foo5', source='foo5.c')
+sl = env.StaticLibrary('sl.c')
+env.Program(target='slprog.c', LIBS=[sl])
+SConscript('sub1/SConscript', 'env')
+SConscript('sub2/SConscript', 'env')
+""" % (bar_lib, bar_lib))
+
+test.write(['sub1', 'SConscript'], r"""
+Import('env')
+lib = env.Library(target='bar', source=Split('bar.c baz.c'))
+env.Install('..', lib)
+""")
+
+test.write(['sub2', 'SConscript'], r"""
+Import('env')
+lib = env.Library(target='baz', source='baz.c')
+env.Install('..', lib)
+""")
+
+foo_contents = r"""
+void bar();
+void baz();
+
+int main(void)
+{
+ bar();
+ baz();
+ return 0;
+}
+"""
+
+test.write('foo1.c', foo_contents)
+test.write('foo2.c', foo_contents)
+test.write('foo3.c', foo_contents)
+test.write('foo4.c', foo_contents)
+test.write('foo5.c', foo_contents)
+
+test.write('sl.c', """\
+#include <stdio.h>
+void
+sl(void)
+{
+ printf("sl.c\\n");
+}
+""")
+
+test.write('slprog.c', """\
+#include <stdio.h>
+int
+main(int argc, char *argv[])
+{
+ sl();
+ printf("slprog.c\\n");
+ exit (0);
+}
+""")
+
+test.write(['sub1', 'bar.c'], r"""
+#include <stdio.h>
+
+void bar()
+{
+ printf("sub1/bar.c\n");
+}
+""")
+
+test.write(['sub1', 'baz.c'], r"""
+#include <stdio.h>
+
+void baz()
+{
+ printf("sub1/baz.c\n");
+}
+""")
+
+test.write(['sub2', 'baz.c'], r"""
+#include <stdio.h>
+
+void baz()
+{
+ printf("sub2/baz.c\n");
+}
+""")
+
+# ar sometimes produces a "warning" on stderr -- ar: creating sub1/libbar.a
+test.run(arguments = '.', stderr=None)
+
+test.run(program=foo1_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
+test.run(program=foo2_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
+test.run(program=foo3_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
+test.run(program=foo4_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
+test.run(program=foo5_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
+test.run(program=slprog_exe, stdout='sl.c\nslprog.c\n')
+
+#
+test.write('SConstruct', """
+env = Environment(LIBS=['baz'])
+env.Program(target='foo1', source='foo1.c', LIBS=['$LIBS', 'bar'], LIBPATH = '.')
+SConscript('sub1/SConscript', 'env')
+SConscript('sub2/SConscript', 'env')
+""")
+
+test.run(arguments = '.')
+
+test.run(program=foo1_exe, stdout='sub1/bar.c\nsub2/baz.c\n')
+
+#
+test.write('SConstruct', """
+env = Environment(LIBS=['bar', 'baz'], LIBPATH = '.')
+env.Program(target='foo1', source='foo1.c')
+SConscript('sub1/SConscript', 'env')
+SConscript('sub2/SConscript', 'env')
+""")
+
+
+# on IRIX, ld32 prints out a warning saying that libbaz.a isn't used
+sw = 'ld32: WARNING 84 : ./libbaz.a is not used for resolving any symbol.\n'
+test.run(arguments = '.',
+ stderr='(%s|%s'%(sw, TestSCons.noisy_ar[1:]),
+ match=TestSCons.match_re_dotall)
+#test.fail_test(not test.stderr() in ['', sw])
+
+test.run(program=foo1_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
+
+#
+test.write('SConstruct', """
+env = Environment()
+env.Program(target='foo1', source='foo1.c', LIBS=['bar', 'baz'], LIBPATH = '.')
+SConscript('sub1/SConscript', 'env')
+SConscript('sub2/SConscript', 'env')
+""")
+
+test.run(arguments = '.')
+
+test.run(program=foo1_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
+
+test.write(['sub1', 'baz.c'], r"""
+#include <stdio.h>
+
+void baz()
+{
+ printf("sub1/baz.c 2\n");
+}
+""")
+
+test.run(arguments = '.',
+ stderr='(%s|%s'%(sw, TestSCons.noisy_ar[1:]),
+ match=TestSCons.match_re_dotall)
+#test.fail_test(not test.stderr() in ['', sw, TestSCons.noisy_ar])
+
+test.run(program=foo1_exe, stdout='sub1/bar.c\nsub1/baz.c 2\n')
+
+# Make sure we don't add $LIBPREFIX to library names that
+# already have the prefix on them.
+blender_exe = test.workpath('blender' + _exe)
+
+test.subdir('src', ['src', 'component1'], ['src', 'component2'])
+
+test.write('SConstruct', """\
+SConscript(['src/SConscript'])
+
+libpath = (['lib'])
+libraries = (['libtest_component2',
+ 'libtest_component1'])
+
+# To remove the dependency problem, you should rename blender to mlender.
+Program (source='main.c', target='blender', LIBS=libraries, LIBPREFIX='lib', LIBPATH=libpath, CPPPATH=['src/component2'])
+""")
+
+test.write('main.c', """\
+#include <stdlib.h>
+#include "message2.h"
+
+int main (void)
+{
+ DisplayMessage2();
+ exit (0);
+}
+""")
+
+test.write(['src', 'SConscript'], """\
+SConscript(['component1/SConscript',
+ 'component2/SConscript'])
+""")
+
+test.write(['src', 'component1', 'SConscript'], """\
+source_files = ['message1.c']
+Library (target='../../lib/libtest_component1', source=source_files, LINKFLAGS='')
+""")
+
+test.write(['src', 'component1', 'message1.c'], """\
+#include <stdio.h>
+
+void DisplayMessage1 (void)
+{
+ printf ("src/component1/message.c\\n");
+}
+""")
+
+test.write(['src', 'component1', 'message1.h'], """\
+void DisplayMessage1 (void);
+""")
+
+test.write(['src', 'component2', 'SConscript'], """\
+source_files = ['message2.c']
+include_paths = ['../component1']
+Library (target='../../lib/libtest_component2', source=source_files, CPPPATH=include_paths)
+""")
+
+test.write(['src', 'component2', 'message2.h'], """\
+void DisplayMessage2 (void);
+""")
+
+test.write(['src', 'component2', 'message2.c'], """\
+#include <stdio.h>
+#include "message1.h"
+
+void DisplayMessage2 (void)
+{
+ DisplayMessage1();
+ printf ("src/component2/hello.c\\n");
+}
+""")
+
+test.run(arguments = '.',
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+
+test.run(program=blender_exe,
+ stdout='src/component1/message.c\nsrc/component2/hello.c\n')
+
+test.pass_test()
diff --git a/test/Libs/LIBSUFFIX.py b/test/Libs/LIBSUFFIX.py
new file mode 100644
index 00000000..a71e9673
--- /dev/null
+++ b/test/Libs/LIBSUFFIX.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.pass_test() #XXX Short-circuit until this is implemented.
+
+test.write('SConstruct', """
+""")
+
+test.run(arguments = '.')
+
+test.pass_test()
diff --git a/test/Libs/LIBSUFFIXES.py b/test/Libs/LIBSUFFIXES.py
new file mode 100644
index 00000000..29cbb18e
--- /dev/null
+++ b/test/Libs/LIBSUFFIXES.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import sys
+import TestSCons
+
+if sys.platform == 'win32':
+ lib_ = ''
+else:
+ lib_ = 'lib'
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env = Environment(LIBSUFFIX = '.xxx',
+ LIBSUFFIXES = ['.xxx'])
+lib = env.Library(target = 'foo', source = 'foo.c')
+env.Program(target = 'prog', source = ['prog.c', lib])
+""")
+
+test.write('foo.c', r"""
+#include <stdio.h>
+
+void
+foo(void)
+{
+ printf("foo.c\n");
+}
+""")
+
+test.write('prog.c', r"""
+#include <stdio.h>
+
+void foo(void);
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ foo();
+ printf("prog.c\n");
+ return 0;
+}
+""")
+
+test.run(arguments = '.',
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+
+test.fail_test(not os.path.exists(test.workpath(lib_ + 'foo.xxx')))
+
+test.run(program = test.workpath('prog'), stdout = "foo.c\nprog.c\n")
+
+test.pass_test()
diff --git a/test/Libs/Library.py b/test/Libs/Library.py
new file mode 100644
index 00000000..4bcb2c7d
--- /dev/null
+++ b/test/Libs/Library.py
@@ -0,0 +1,167 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env = Environment(LIBS = [ 'foo1', 'libfoo2' ],
+ LIBPATH = [ '.' ])
+env.Library(target = 'foo1', source = 'f1.c')
+Library(target = 'libfoo2', source = Split('f2a.c f2b.c f2c.c'))
+libtgt=env.Library(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.cpp'])
+env.Program(target = 'prog', source = [ 'prog.cpp', libtgt ])
+""")
+
+test.write('f1.c', r"""
+#include <stdio.h>
+void
+f1(void)
+{
+ printf("f1.c\n");
+}
+""")
+
+test.write('f2a.c', r"""
+#include <stdio.h>
+void
+f2a(void)
+{
+ printf("f2a.c\n");
+}
+""")
+
+test.write('f2b.c', r"""
+#include <stdio.h>
+void
+f2b(void)
+{
+ printf("f2b.c\n");
+}
+""")
+
+test.write('f2c.c', r"""
+#include <stdio.h>
+void
+f2c(void)
+{
+ printf("f2c.c\n");
+}
+""")
+
+test.write('f3a.c', r"""
+#include <stdio.h>
+void
+f3a(void)
+{
+ printf("f3a.c\n");
+}
+""")
+
+test.write('f3b.c', r"""
+#include <stdio.h>
+void
+f3b(void)
+{
+ printf("f3b.c\n");
+}
+""")
+
+test.write('f3c.cpp', r"""
+#include <stdio.h>
+extern "C" void
+f3c(void)
+{
+ printf("f3c.cpp\n");
+}
+""")
+
+test.write('prog.cpp', r"""
+#include <stdio.h>
+extern "C" {
+void f1(void);
+void f2a(void);
+void f2b(void);
+void f2c(void);
+void f3a(void);
+void f3b(void);
+void f3c(void);
+}
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = (char *)"--";
+ f1();
+ f2a();
+ f2b();
+ f2c();
+ f3a();
+ f3b();
+ f3c();
+ printf("prog.c\n");
+ return 0;
+}
+""")
+
+test.run(arguments = '.',
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+
+test.run(program = test.workpath('prog'),
+ stdout = "f1.c\nf2a.c\nf2b.c\nf2c.c\nf3a.c\nf3b.c\nf3c.cpp\nprog.c\n")
+
+# Tests whether you can reference libraries with substitutions.
+
+test.write('SConstruct', r"""
+# nrd = not referenced directly :)
+Library('nrd', 'nrd.c')
+p = Program('uses-nrd', 'uses-nrd.c', NRD='nrd', LIBPATH=['.'], LIBS=['$NRD'])
+Default(p)
+""")
+
+test.write('nrd.c', r"""
+#include <stdio.h>
+void nrd() {
+ puts("nrd");
+}
+""")
+
+test.write('uses-nrd.c', r"""
+void nrd();
+int main() {
+ nrd();
+ return 0;
+}
+""")
+
+test.run(stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+
+test.run(program = test.workpath('uses-nrd'),
+ stdout = "nrd\n")
+
+test.pass_test()
diff --git a/test/Libs/SHLIBPREFIX.py b/test/Libs/SHLIBPREFIX.py
new file mode 100644
index 00000000..87b92fae
--- /dev/null
+++ b/test/Libs/SHLIBPREFIX.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import sys
+import TestSCons
+
+_lib = TestSCons._dll
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env = Environment(SHLIBPREFIX = 'shlib-')
+env.SharedLibrary(target = 'foo', source = 'foo.c')
+""")
+
+test.write('foo.c', r"""
+#include <stdio.h>
+void
+foo(void)
+{
+ printf("foo.c\n");
+}
+""")
+
+test.run(arguments = '.')
+
+test.fail_test(not os.path.exists(test.workpath('shlib-foo' + _lib)))
+
+test.pass_test()
diff --git a/test/Libs/SHLIBSUFFIX.py b/test/Libs/SHLIBSUFFIX.py
new file mode 100644
index 00000000..dc88e3b1
--- /dev/null
+++ b/test/Libs/SHLIBSUFFIX.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import sys
+import TestSCons
+
+dll_ = TestSCons.dll_
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+env = Environment(SHLIBSUFFIX = '.shlib')
+env.SharedLibrary(target = 'foo', source = 'foo.c')
+""")
+
+test.write('foo.c', r"""
+#include <stdio.h>
+void
+foo(void)
+{
+ printf("foo.c\n");
+}
+""")
+
+test.run(arguments = '.')
+
+test.fail_test(not os.path.exists(test.workpath(dll_ + 'foo.shlib')))
+
+test.pass_test()
diff --git a/test/Libs/SharedLibrary.py b/test/Libs/SharedLibrary.py
new file mode 100644
index 00000000..f8447ca3
--- /dev/null
+++ b/test/Libs/SharedLibrary.py
@@ -0,0 +1,285 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import string
+import sys
+
+import TestCmd
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+import sys
+env=Environment(WINDOWS_INSERT_DEF=1)
+env2 = Environment(LIBS = [ 'foo1', 'foo2', 'foo3' ],
+ LIBPATH = [ '.' ])
+env.SharedLibrary(target = 'foo1', source = 'f1.c')
+if sys.platform == 'win32':
+ env.StaticLibrary(target = 'foo1-static', source = 'f1.c')
+else:
+ env.StaticLibrary(target = 'foo1', source = 'f1.c')
+SharedLibrary(target = 'foo2',
+ source = Split('f2a.c f2b.c f2c.c'),
+ WINDOWS_INSERT_DEF = 1)
+env.SharedLibrary(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c'])
+env2.Program(target = 'prog', source = 'prog.c')
+""")
+
+test.write('SConstructFoo', """
+env=Environment()
+obj = env.Object('foo', 'foo.c')
+Default(env.SharedLibrary(target = 'foo', source = obj))
+""")
+
+test.write('SConstructFoo2', """
+env=Environment()
+obj = env.SharedObject('bar', 'foo.c')
+Default(env.Library(target = 'foo', source = obj))
+""")
+
+test.write('foo.c', r"""
+#include <stdio.h>
+
+void
+f1(void)
+{
+ printf("foo.c\n");
+ fflush(stdout);
+}
+""")
+
+
+test.write('f1.c', r"""
+#include <stdio.h>
+
+void
+f1(void)
+{
+ printf("f1.c\n");
+ fflush(stdout);
+}
+""")
+
+test.write("foo1.def", r"""
+LIBRARY "foo1"
+DESCRIPTION "Foo1 Shared Library"
+
+EXPORTS
+ f1
+""")
+
+test.write('f2a.c', r"""
+#include <stdio.h>
+
+void
+f2a(void)
+{
+ printf("f2a.c\n");
+}
+""")
+
+test.write('f2b.c', r"""
+#include <stdio.h>
+void
+f2b(void)
+{
+ printf("f2b.c\n");
+}
+""")
+
+test.write('f2c.c', r"""
+#include <stdio.h>
+
+void
+f2c(void)
+{
+ printf("f2c.c\n");
+ fflush(stdout);
+}
+""")
+
+test.write("foo2.def", r"""
+LIBRARY "foo2"
+DESCRIPTION "Foo2 Shared Library"
+
+EXPORTS
+ f2a
+ f2b
+ f2c
+""")
+
+test.write('f3a.c', r"""
+#include <stdio.h>
+void
+f3a(void)
+{
+ printf("f3a.c\n");
+}
+""")
+
+test.write('f3b.c', r"""
+#include <stdio.h>
+void
+f3b(void)
+{
+ printf("f3b.c\n");
+}
+""")
+
+test.write('f3c.c', r"""
+#include <stdio.h>
+
+void
+f3c(void)
+{
+ printf("f3c.c\n");
+ fflush(stdout);
+}
+""")
+
+test.write("foo3.def", r"""
+LIBRARY "foo3"
+DESCRIPTION "Foo3 Shared Library"
+
+EXPORTS
+ f3a
+ f3b
+ f3c
+""")
+
+test.write('prog.c', r"""
+#include <stdio.h>
+void f1(void);
+void f2a(void);
+void f2b(void);
+void f2c(void);
+void f3a(void);
+void f3b(void);
+void f3c(void);
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ f1();
+ f2a();
+ f2b();
+ f2c();
+ f3a();
+ f3b();
+ f3c();
+ printf("prog.c\n");
+ return 0;
+}
+""")
+
+test.run(arguments = '.',
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+
+if os.name == 'posix':
+ os.environ['LD_LIBRARY_PATH'] = '.'
+if string.find(sys.platform, 'irix') != -1:
+ os.environ['LD_LIBRARYN32_PATH'] = '.'
+
+test.run(program = test.workpath('prog'),
+ stdout = "f1.c\nf2a.c\nf2b.c\nf2c.c\nf3a.c\nf3b.c\nf3c.c\nprog.c\n")
+
+if sys.platform == 'win32' or string.find(sys.platform, 'irix') != -1:
+ test.run(arguments = '-f SConstructFoo')
+else:
+ test.run(arguments = '-f SConstructFoo', status=2, stderr='''\
+scons: \*\*\* Source file: foo\..* is static and is not compatible with shared target: .*
+''',
+ match=TestSCons.match_re_dotall)
+ # Run it again to make sure that we still get the error
+ # even though the static objects already exist.
+ test.run(arguments = '-f SConstructFoo', status=2, stderr='''\
+scons: \*\*\* Source file: foo\..* is static and is not compatible with shared target: .*
+''',
+ match=TestSCons.match_re_dotall)
+
+test.run(arguments = '-f SConstructFoo2',
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+
+if sys.platform == 'win32':
+ # Make sure we don't insert a .def source file (when
+ # WINDOWS_INSERT_DEF is set) and a .lib target file if
+ # they're specified explicitly.
+
+ test.write('SConstructBar', '''
+env = Environment(WINDOWS_INSERT_DEF=1)
+env2 = Environment(LIBS = [ 'foo4' ],
+ LIBPATH = [ '.' ])
+env.SharedLibrary(target = ['foo4', 'foo4.lib'], source = ['f4.c', 'foo4.def'])
+env2.Program(target = 'progbar', source = 'progbar.c')
+''')
+
+ test.write('f4.c', r"""
+#include <stdio.h>
+
+f4(void)
+{
+ printf("f4.c\n");
+ fflush(stdout);
+}
+""")
+
+ test.write("foo4.def", r"""
+LIBRARY "foo4"
+DESCRIPTION "Foo4 Shared Library"
+
+EXPORTS
+ f4
+""")
+
+ test.write('progbar.c', r"""
+#include <stdio.h>
+void f4(void);
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ f4();
+ printf("progbar.c\n");
+ return 0;
+}
+""")
+
+ test.run(arguments = '-f SConstructBar .')
+
+ # Make sure there is (at most) one mention each of the
+ # appropriate .def and .lib files per line.
+ for line in string.split(test.stdout(), '\n'):
+ test.fail_test(string.count(line, 'foo4.def') > 1)
+ test.fail_test(string.count(line, 'foo4.lib') > 1)
+
+ test.run(program = test.workpath('progbar'),
+ stdout = "f4.c\nprogbar.c\n")
+
+test.pass_test()
diff --git a/test/Libs/SharedLibraryIxes.py b/test/Libs/SharedLibraryIxes.py
new file mode 100644
index 00000000..f9d14711
--- /dev/null
+++ b/test/Libs/SharedLibraryIxes.py
@@ -0,0 +1,261 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test that we can build shared libraries and link against shared
+libraries that have non-standard library prefixes and suffixes.
+"""
+
+import re
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """
+import sys
+isWindows = sys.platform == 'win32'
+
+env = Environment()
+
+# Make sure that the shared library can be located at runtime.
+env.Append(RPATH=['.'])
+env.Append(LIBPATH=['.'])
+
+# We first bake the LIBSUFFIXES, so that it will not change as a
+# side-effect of changing SHLIBSUFFIX.
+env['LIBSUFFIXES'] = map( env.subst, env.get('LIBSUFFIXES', []))
+
+weird_prefixes = ['libXX', 'libYY']
+
+if isWindows:
+ weird_suffixes = ['.xxx', '.yyy', '.xxx.dll', '.yyy.dll']
+ env.Append(CCFLAGS = '/MD')
+elif env['PLATFORM'] == 'darwin':
+ weird_suffixes = ['.xxx.dylib', '.yyy.dylib']
+else:
+ weird_suffixes = ['.xxx.so', '.yyy.so']
+
+shlibprefix = env.subst('$SHLIBPREFIX')
+shlibsuffix = env.subst('$SHLIBSUFFIX')
+
+progprefix = env.subst('$PROGPREFIX')
+progsuffix = env.subst('$PROGSUFFIX')
+
+goo_obj = env.SharedObject(source='goo.c')
+foo_obj = env.SharedObject(source='foo.c')
+prog_obj = env.SharedObject(source='prog.c')
+
+#
+# The following functions define all the different way that one can
+# use link againt a shared library.
+#
+def nodeInSrc(source, lib, libname):
+ return (source+lib, '')
+
+def pathInSrc(source, lib, libname):
+ return (source+map(str,lib), '')
+
+def nodeInLib(source, lib, libname):
+ return (source, lib)
+
+def pathInLib(source, lib, libname):
+ return (source, map(str,lib))
+
+def nameInLib(source, lib, libname):
+ # NOTE: libname must contain both the proper prefix and suffix.
+ #
+ # When using non-standard prefixes and suffixes, one has to
+ # provide the full name of the library since scons can not know
+ # which of the non-standard extension to use.
+ #
+ # Note that this is not necessarally SHLIBPREFIX and
+ # SHLIBSUFFIX. These are the ixes of the target library, not the
+ # ixes of the library that we are linking againt.
+ return (source, libname)
+
+libmethods = [
+ nodeInSrc, pathInSrc, nodeInLib, pathInLib,
+ nameInLib ]
+
+def buildAndlinkAgainst(builder, target, source, method, lib, libname, **kw):
+ '''Build a target using a given builder while linking againt a given
+ library using a specified method for linking against the library.'''
+
+ # On Windows, we have to link against the .lib file.
+ if isWindows:
+ for l in lib:
+ if str(l)[-4:] == '.lib':
+ lib = [l]
+ break
+ (source, LIBS) = method(source, lib, libname)
+ #build = builder(target=target, source=source, LIBS=LIBS, **kw)
+ kw = kw.copy()
+ kw['target'] = target
+ kw['source'] = source
+ kw['LIBS'] = LIBS
+ build = apply(builder, (), kw)
+
+ # Check that the build target depends on at least one of the
+ # library target.
+ found_dep = False
+ children = build[0].children()
+ for l in lib:
+ if l in children:
+ found_dep = True
+ break;
+ assert found_dep, \
+ "One of %s not found in %s, method=%s, libname=%s, shlibsuffix=%s" % \
+ (map(str,lib), map(str, build[0].children()), method.__name__, libname, shlibsuffix)
+ return build
+
+def prog(i,
+ goomethod, goolibprefix, goolibsuffix,
+ foomethod, foolibprefix, foolibsuffix):
+ '''Build a program
+
+ The program links against a shared library foo which itself links
+ against a shared library goo. The libraries foo and goo can use
+ arbitrary library prefixes and suffixes.'''
+
+ goo_name = goolibprefix+'goo'+str(i)+goolibsuffix
+ foo_name = foolibprefix+'foo'+str(i)+foolibsuffix
+ prog_name = progprefix+'prog'+str(i)+progsuffix
+
+ print 'Prog: %d, %s, %s, %s' % (i, goo_name, foo_name, prog_name)
+
+ # On Windows, we have to link against the .lib file.
+ if isWindows:
+ goo_libname = goolibprefix+'goo'+str(i)+'.lib'
+ foo_libname = foolibprefix+'foo'+str(i)+'.lib'
+ else:
+ goo_libname = goo_name
+ foo_libname = foo_name
+
+ goo_lib = env.SharedLibrary(
+ goo_name, goo_obj, SHLIBSUFFIX=goolibsuffix)
+ foo_lib = buildAndlinkAgainst(
+ env.SharedLibrary, foo_name, foo_obj,
+ goomethod, goo_lib, goo_libname, SHLIBSUFFIX=foolibsuffix)
+ prog = buildAndlinkAgainst(env.Program, prog_name, prog_obj,
+ foomethod, foo_lib, foo_libname)
+
+
+#
+# Create the list of all possible permutations to test.
+#
+i = 0
+tests = []
+prefixes = [shlibprefix] + weird_prefixes
+suffixes = [shlibsuffix] + weird_suffixes
+for foolibprefix in prefixes:
+ for foolibsuffix in suffixes:
+ for foomethod in libmethods:
+ for goolibprefix in prefixes:
+ for goolibsuffix in suffixes:
+ for goomethod in libmethods:
+ tests.append(
+ (i,
+ goomethod, goolibprefix, goolibsuffix,
+ foomethod, foolibprefix, foolibsuffix))
+ i = i + 1
+
+#
+# Pseudo-randomly choose 200 tests to run out of the possible
+# tests. (Testing every possible permutation would take too long.)
+#
+import random
+random.seed(123456)
+try:
+ random.shuffle(tests)
+except AttributeError:
+ pass
+
+for i in range(200):
+ apply(prog, tests[i])
+
+""")
+
+test.write('goo.c', r"""
+#include <stdio.h>
+
+#ifdef _WIN32
+#define EXPORT __declspec( dllexport )
+#else
+#define EXPORT
+#endif
+
+EXPORT void
+goo(void)
+{
+ printf("goo.c\n");
+}
+""")
+
+test.write('foo.c', r"""
+#include <stdio.h>
+
+#ifdef _WIN32
+#define EXPORT __declspec( dllexport )
+#else
+#define EXPORT
+#endif
+
+EXPORT void
+foo(void)
+{
+ goo();
+ printf("foo.c\n");
+}
+""")
+
+test.write('prog.c', r"""
+#include <stdio.h>
+
+void foo(void);
+int
+main(int argc, char *argv[])
+{
+ argv[argc++] = "--";
+ foo();
+ printf("prog.c\n");
+ return 0;
+}
+""")
+
+test.run(arguments = '.',
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
+
+tests = re.findall(r'Prog: (\d+), (\S+), (\S+), (\S+)', test.stdout())
+expected = "goo.c\nfoo.c\nprog.c\n"
+
+for t in tests:
+ test.must_exist(t[1])
+ test.must_exist(t[2])
+ test.must_exist(t[3])
+ test.run(program = test.workpath(t[3]), stdout=expected)
+
+test.pass_test()