summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Gross <grossag@vmware.com>2019-12-04 01:43:46 (GMT)
committerAdam Gross <grossag@vmware.com>2019-12-04 01:43:46 (GMT)
commit5df60c3f82a68acbc7f51769822a715259a9210d (patch)
tree9680539a619e12f0507f660862ce993a2e40ca0a
parentb2866a6821ba0575535e259a6a74e911c0d7c735 (diff)
downloadSCons-5df60c3f82a68acbc7f51769822a715259a9210d.zip
SCons-5df60c3f82a68acbc7f51769822a715259a9210d.tar.gz
SCons-5df60c3f82a68acbc7f51769822a715259a9210d.tar.bz2
Add repository-related test coverage of the new code
That was missing in the codecov report.
-rw-r--r--test/Repository/Program.py195
-rw-r--r--test/Repository/StaticLibrary.py165
2 files changed, 180 insertions, 180 deletions
diff --git a/test/Repository/Program.py b/test/Repository/Program.py
index 1eb18d8..9260ae9 100644
--- a/test/Repository/Program.py
+++ b/test/Repository/Program.py
@@ -32,25 +32,22 @@ if sys.platform == 'win32':
else:
_exe = ''
-test = TestSCons.TestSCons()
-
-
-
-# First, test a single repository.
-test.subdir('repository', 'work1')
-
-repository = test.workpath('repository')
-repository_foo_c = test.workpath('repository', 'foo.c')
-work1_foo = test.workpath('work1', 'foo' + _exe)
-work1_foo_c = test.workpath('work1', 'foo.c')
-
-test.write(['work1', 'SConstruct'], r"""
+for implicit_deps in ['0', '1', '2']:
+ # First, test a single repository.
+ test = TestSCons.TestSCons()
+ test.subdir('repository', 'work1')
+ repository = test.workpath('repository')
+ repository_foo_c = test.workpath('repository', 'foo.c')
+ work1_foo = test.workpath('work1', 'foo' + _exe)
+ work1_foo_c = test.workpath('work1', 'foo.c')
+
+ test.write(['work1', 'SConstruct'], r"""
Repository(r'%s')
-env = Environment()
+env = Environment(IMPLICIT_COMMAND_DEPENDENCIES=%s)
env.Program(target= 'foo', source = Split('aaa.c bbb.c foo.c'))
-""" % repository)
+""" % (repository, implicit_deps))
-test.write(['repository', 'aaa.c'], r"""
+ test.write(['repository', 'aaa.c'], r"""
#include <stdio.h>
void
aaa(void)
@@ -59,7 +56,7 @@ aaa(void)
}
""")
-test.write(['repository', 'bbb.c'], r"""
+ test.write(['repository', 'bbb.c'], r"""
#include <stdio.h>
void
bbb(void)
@@ -68,7 +65,7 @@ bbb(void)
}
""")
-test.write(['repository', 'foo.c'], r"""
+ test.write(['repository', 'foo.c'], r"""
#include <stdio.h>
#include <stdlib.h>
@@ -85,21 +82,21 @@ main(int argc, char *argv[])
}
""")
-# Make the entire repository non-writable, so we'll detect
-# if we try to write into it accidentally.
-test.writable('repository', 0)
+ # Make the entire repository non-writable, so we'll detect
+ # if we try to write into it accidentally.
+ test.writable('repository', 0)
-test.run(chdir = 'work1', arguments = '.')
+ test.run(chdir = 'work1', arguments = '.')
-test.run(program = work1_foo, stdout = """repository/aaa.c
+ test.run(program = work1_foo, stdout = """repository/aaa.c
repository/bbb.c
repository/foo.c
""")
-test.up_to_date(chdir = 'work1', arguments = '.')
+ test.up_to_date(chdir = 'work1', arguments = '.')
-#
-test.write(['work1', 'bbb.c'], r"""
+ #
+ test.write(['work1', 'bbb.c'], r"""
#include <stdio.h>
void
bbb(void)
@@ -108,17 +105,17 @@ bbb(void)
}
""")
-test.run(chdir = 'work1', arguments = '.')
+ test.run(chdir = 'work1', arguments = '.')
-test.run(program = work1_foo, stdout = """repository/aaa.c
+ test.run(program = work1_foo, stdout = """repository/aaa.c
work1/bbb.c
repository/foo.c
""")
-test.up_to_date(chdir = 'work1', arguments = '.')
+ test.up_to_date(chdir = 'work1', arguments = '.')
-#
-test.write(['work1', 'aaa.c'], r"""
+ #
+ test.write(['work1', 'aaa.c'], r"""
#include <stdio.h>
void
aaa(void)
@@ -127,7 +124,7 @@ aaa(void)
}
""")
-test.write(['work1', 'foo.c'], r"""
+ test.write(['work1', 'foo.c'], r"""
#include <stdio.h>
#include <stdlib.h>
extern void aaa(void);
@@ -143,57 +140,57 @@ main(int argc, char *argv[])
}
""")
-test.run(chdir = 'work1', arguments = '.')
+ test.run(chdir = 'work1', arguments = '.')
-test.run(program = work1_foo, stdout = """work1/aaa.c
+ test.run(program = work1_foo, stdout = """work1/aaa.c
work1/bbb.c
work1/foo.c
""")
-test.up_to_date(chdir = 'work1', arguments = '.')
+ test.up_to_date(chdir = 'work1', arguments = '.')
-#
-test.unlink(['work1', 'aaa.c'])
+ #
+ test.unlink(['work1', 'aaa.c'])
-test.run(chdir = 'work1', arguments = '.')
+ test.run(chdir = 'work1', arguments = '.')
-test.run(program = work1_foo, stdout = """repository/aaa.c
+ test.run(program = work1_foo, stdout = """repository/aaa.c
work1/bbb.c
work1/foo.c
""")
-test.up_to_date(chdir = 'work1', arguments = '.')
+ test.up_to_date(chdir = 'work1', arguments = '.')
-#
-test.unlink(['work1', 'bbb.c'])
-test.unlink(['work1', 'foo.c'])
+ #
+ test.unlink(['work1', 'bbb.c'])
+ test.unlink(['work1', 'foo.c'])
-test.run(chdir = 'work1', arguments = '.')
+ test.run(chdir = 'work1', arguments = '.')
-test.run(program = work1_foo, stdout = """repository/aaa.c
+ test.run(program = work1_foo, stdout = """repository/aaa.c
repository/bbb.c
repository/foo.c
""")
-test.up_to_date(chdir = 'work1', arguments = '.')
+ test.up_to_date(chdir = 'work1', arguments = '.')
-# Now, test multiple repositories.
-test.subdir('repository.new', 'repository.old', 'work2')
+ # Now, test multiple repositories.
+ test.subdir('repository.new', 'repository.old', 'work2')
-repository_new = test.workpath('repository.new')
-repository_old = test.workpath('repository.old')
-work2_foo = test.workpath('work2', 'foo' + _exe)
+ repository_new = test.workpath('repository.new')
+ repository_old = test.workpath('repository.old')
+ work2_foo = test.workpath('work2', 'foo' + _exe)
-test.write(['work2', 'SConstruct'], r"""
+ test.write(['work2', 'SConstruct'], r"""
Repository(r'%s')
Repository(r'%s')
env = Environment()
env.Program(target= 'foo', source = Split('aaa.c bbb.c foo.c'))
""" % (repository_new, repository_old))
-test.write(['repository.old', 'aaa.c'], r"""
+ test.write(['repository.old', 'aaa.c'], r"""
#include <stdio.h>
void
aaa(void)
@@ -202,7 +199,7 @@ aaa(void)
}
""")
-test.write(['repository.old', 'bbb.c'], r"""
+ test.write(['repository.old', 'bbb.c'], r"""
#include <stdio.h>
void
bbb(void)
@@ -211,7 +208,7 @@ bbb(void)
}
""")
-test.write(['repository.old', 'foo.c'], r"""
+ test.write(['repository.old', 'foo.c'], r"""
#include <stdio.h>
#include <stdlib.h>
extern void aaa(void);
@@ -227,24 +224,24 @@ main(int argc, char *argv[])
}
""")
-# Make both repositories non-writable, so we'll detect
-# if we try to write into it accidentally.
-test.writable('repository.new', 0)
-test.writable('repository.old', 0)
+ # Make both repositories non-writable, so we'll detect
+ # if we try to write into it accidentally.
+ test.writable('repository.new', 0)
+ test.writable('repository.old', 0)
-test.run(chdir = 'work2', arguments = '.')
+ test.run(chdir = 'work2', arguments = '.')
-test.run(program = work2_foo, stdout = """repository.old/aaa.c
+ test.run(program = work2_foo, stdout = """repository.old/aaa.c
repository.old/bbb.c
repository.old/foo.c
""")
-test.up_to_date(chdir = 'work2', arguments = '.')
+ test.up_to_date(chdir = 'work2', arguments = '.')
-#
-test.writable('repository.new', 1)
+ #
+ test.writable('repository.new', 1)
-test.write(['repository.new', 'aaa.c'], r"""
+ test.write(['repository.new', 'aaa.c'], r"""
#include <stdio.h>
#include <stdlib.h>
void
@@ -254,7 +251,7 @@ aaa(void)
}
""")
-test.write(['work2', 'bbb.c'], r"""
+ test.write(['work2', 'bbb.c'], r"""
#include <stdio.h>
#include <stdlib.h>
void
@@ -264,20 +261,20 @@ bbb(void)
}
""")
-#
-test.writable('repository.new', 0)
+ #
+ test.writable('repository.new', 0)
-test.run(chdir = 'work2', arguments = '.')
+ test.run(chdir = 'work2', arguments = '.')
-test.run(program = work2_foo, stdout = """repository.new/aaa.c
+ test.run(program = work2_foo, stdout = """repository.new/aaa.c
work2/bbb.c
repository.old/foo.c
""")
-test.up_to_date(chdir = 'work2', arguments = '.')
+ test.up_to_date(chdir = 'work2', arguments = '.')
-#
-test.write(['work2', 'aaa.c'], r"""
+ #
+ test.write(['work2', 'aaa.c'], r"""
#include <stdio.h>
#include <stdlib.h>
void
@@ -287,7 +284,7 @@ aaa(void)
}
""")
-test.write(['work2', 'foo.c'], r"""
+ test.write(['work2', 'foo.c'], r"""
#include <stdio.h>
#include <stdlib.h>
extern void aaa(void);
@@ -303,59 +300,59 @@ main(int argc, char *argv[])
}
""")
-#
-test.run(chdir = 'work2', arguments = '.')
+ #
+ test.run(chdir = 'work2', arguments = '.')
-test.run(program = work2_foo, stdout = """work2/aaa.c
+ test.run(program = work2_foo, stdout = """work2/aaa.c
work2/bbb.c
work2/foo.c
""")
-test.up_to_date(chdir = 'work2', arguments = '.')
+ test.up_to_date(chdir = 'work2', arguments = '.')
-#
-test.unlink(['work2', 'aaa.c'])
-test.unlink(['work2', 'bbb.c'])
+ #
+ test.unlink(['work2', 'aaa.c'])
+ test.unlink(['work2', 'bbb.c'])
-#
-test.run(chdir = 'work2', arguments = '.')
+ #
+ test.run(chdir = 'work2', arguments = '.')
-test.run(program = work2_foo, stdout = """repository.new/aaa.c
+ test.run(program = work2_foo, stdout = """repository.new/aaa.c
repository.old/bbb.c
work2/foo.c
""")
-test.up_to_date(chdir = 'work2', arguments = '.')
+ test.up_to_date(chdir = 'work2', arguments = '.')
-#
-test.unlink(['work2', 'foo.c'])
+ #
+ test.unlink(['work2', 'foo.c'])
-#
-test.run(chdir = 'work2', arguments = '.')
+ #
+ test.run(chdir = 'work2', arguments = '.')
-test.run(program = work2_foo, stdout = """repository.new/aaa.c
+ test.run(program = work2_foo, stdout = """repository.new/aaa.c
repository.old/bbb.c
repository.old/foo.c
""")
-test.up_to_date(chdir = 'work2', arguments = '.')
+ test.up_to_date(chdir = 'work2', arguments = '.')
-#
-test.writable('repository.new', 1)
+ #
+ test.writable('repository.new', 1)
-test.unlink(['repository.new', 'aaa.c'])
+ test.unlink(['repository.new', 'aaa.c'])
-test.writable('repository.new', 0)
+ test.writable('repository.new', 0)
-#
-test.run(chdir = 'work2', arguments = '.')
+ #
+ test.run(chdir = 'work2', arguments = '.')
-test.run(program = work2_foo, stdout = """repository.old/aaa.c
+ test.run(program = work2_foo, stdout = """repository.old/aaa.c
repository.old/bbb.c
repository.old/foo.c
""")
-test.up_to_date(chdir = 'work2', arguments = '.')
+ test.up_to_date(chdir = 'work2', arguments = '.')
#
diff --git a/test/Repository/StaticLibrary.py b/test/Repository/StaticLibrary.py
index 4f8160c..d619bb3 100644
--- a/test/Repository/StaticLibrary.py
+++ b/test/Repository/StaticLibrary.py
@@ -30,35 +30,37 @@ import TestSCons
_obj = TestSCons._obj
_exe = TestSCons._exe
-test = TestSCons.TestSCons()
-
-#
-test.subdir('repository', 'work1', 'work2', 'work3')
-
-#
-workpath_repository = test.workpath('repository')
-repository_aaa_obj = test.workpath('repository', 'aaa' + _obj)
-repository_bbb_obj = test.workpath('repository', 'bbb' + _obj)
-repository_foo_obj = test.workpath('repository', 'foo' + _obj)
-repository_foo = test.workpath('repository', 'foo' + _exe)
-work1_foo = test.workpath('work1', 'foo' + _exe)
-work2_aaa_obj = test.workpath('work2', 'aaa' + _obj)
-work2_foo_obj = test.workpath('work2', 'foo' + _obj)
-work2_foo = test.workpath('work2', 'foo' + _exe)
-work3_aaa_obj = test.workpath('work3', 'aaa' + _obj)
-work3_bbb_obj = test.workpath('work3', 'bbb' + _obj)
-work3_foo = test.workpath('work3', 'foo' + _exe)
-
-opts = '-Y ' + workpath_repository
-
-#
-test.write(['repository', 'SConstruct'], """
-env = Environment(LIBS = ['xxx'], LIBPATH = '.')
+for implicit_deps in ['0', '1', '2']:
+ test = TestSCons.TestSCons()
+
+ #
+ test.subdir('repository', 'work1', 'work2', 'work3')
+
+ #
+ workpath_repository = test.workpath('repository')
+ repository_aaa_obj = test.workpath('repository', 'aaa' + _obj)
+ repository_bbb_obj = test.workpath('repository', 'bbb' + _obj)
+ repository_foo_obj = test.workpath('repository', 'foo' + _obj)
+ repository_foo = test.workpath('repository', 'foo' + _exe)
+ work1_foo = test.workpath('work1', 'foo' + _exe)
+ work2_aaa_obj = test.workpath('work2', 'aaa' + _obj)
+ work2_foo_obj = test.workpath('work2', 'foo' + _obj)
+ work2_foo = test.workpath('work2', 'foo' + _exe)
+ work3_aaa_obj = test.workpath('work3', 'aaa' + _obj)
+ work3_bbb_obj = test.workpath('work3', 'bbb' + _obj)
+ work3_foo = test.workpath('work3', 'foo' + _exe)
+
+ opts = '-Y ' + workpath_repository
+
+ #
+ test.write(['repository', 'SConstruct'], """
+env = Environment(LIBS = ['xxx'], LIBPATH = '.',
+ IMPLICIT_COMMAND_DEPENDENCIES=%s)
env.Library(target = 'xxx', source = ['aaa.c', 'bbb.c'])
env.Program(target = 'foo', source = 'foo.c')
-""")
+""" % implicit_deps)
-test.write(['repository', 'aaa.c'], r"""
+ test.write(['repository', 'aaa.c'], r"""
#include <stdio.h>
#include <stdlib.h>
void
@@ -68,7 +70,7 @@ aaa(void)
}
""")
-test.write(['repository', 'bbb.c'], r"""
+ test.write(['repository', 'bbb.c'], r"""
#include <stdio.h>
#include <stdlib.h>
void
@@ -78,7 +80,7 @@ bbb(void)
}
""")
-test.write(['repository', 'foo.c'], r"""
+ test.write(['repository', 'foo.c'], r"""
#include <stdio.h>
#include <stdlib.h>
extern void aaa(void);
@@ -94,29 +96,29 @@ main(int argc, char *argv[])
}
""")
-# Make the repository non-writable,
-# so we'll detect if we try to write into it accidentally.
-test.writable('repository', 0)
+ # Make the repository non-writable,
+ # so we'll detect if we try to write into it accidentally.
+ test.writable('repository', 0)
-#
-test.run(chdir = 'work1', options = opts, arguments = ".",
- stderr=TestSCons.noisy_ar,
- match=TestSCons.match_re_dotall)
+ #
+ test.run(chdir = 'work1', options = opts, arguments = ".",
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
-test.run(program = work1_foo, stdout =
+ test.run(program = work1_foo, stdout =
"""repository/aaa.c
repository/bbb.c
repository/foo.c
""")
-test.fail_test(os.path.exists(repository_aaa_obj))
-test.fail_test(os.path.exists(repository_bbb_obj))
-test.fail_test(os.path.exists(repository_foo_obj))
-test.fail_test(os.path.exists(repository_foo))
+ test.fail_test(os.path.exists(repository_aaa_obj))
+ test.fail_test(os.path.exists(repository_bbb_obj))
+ test.fail_test(os.path.exists(repository_foo_obj))
+ test.fail_test(os.path.exists(repository_foo))
-test.up_to_date(chdir = 'work1', options = opts, arguments = ".")
+ test.up_to_date(chdir = 'work1', options = opts, arguments = ".")
-test.write(['work1', 'bbb.c'], r"""
+ test.write(['work1', 'bbb.c'], r"""
#include <stdio.h>
#include <stdlib.h>
void
@@ -126,49 +128,49 @@ bbb(void)
}
""")
-test.run(chdir = 'work1', options = opts, arguments = ".",
- stderr=TestSCons.noisy_ar,
- match=TestSCons.match_re_dotall)
+ test.run(chdir = 'work1', options = opts, arguments = ".",
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
-test.run(program = work1_foo, stdout =
+ test.run(program = work1_foo, stdout =
"""repository/aaa.c
work1/bbb.c
repository/foo.c
""")
-test.fail_test(os.path.exists(repository_aaa_obj))
-test.fail_test(os.path.exists(repository_bbb_obj))
-test.fail_test(os.path.exists(repository_foo_obj))
-test.fail_test(os.path.exists(repository_foo))
+ test.fail_test(os.path.exists(repository_aaa_obj))
+ test.fail_test(os.path.exists(repository_bbb_obj))
+ test.fail_test(os.path.exists(repository_foo_obj))
+ test.fail_test(os.path.exists(repository_foo))
-test.up_to_date(chdir = 'work1', options = opts, arguments = ".")
+ test.up_to_date(chdir = 'work1', options = opts, arguments = ".")
-#
-test.writable('repository', 1)
+ #
+ test.writable('repository', 1)
-test.run(chdir = 'repository', options = opts, arguments = ".",
- stderr=TestSCons.noisy_ar,
- match=TestSCons.match_re_dotall)
+ test.run(chdir = 'repository', options = opts, arguments = ".",
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
-test.run(program = repository_foo, stdout =
+ test.run(program = repository_foo, stdout =
"""repository/aaa.c
repository/bbb.c
repository/foo.c
""")
-test.fail_test(not os.path.exists(repository_aaa_obj))
-test.fail_test(not os.path.exists(repository_bbb_obj))
-test.fail_test(not os.path.exists(repository_foo_obj))
+ test.fail_test(not os.path.exists(repository_aaa_obj))
+ test.fail_test(not os.path.exists(repository_bbb_obj))
+ test.fail_test(not os.path.exists(repository_foo_obj))
-test.up_to_date(chdir = 'repository', options = opts, arguments = ".")
+ test.up_to_date(chdir = 'repository', options = opts, arguments = ".")
-#
-test.writable('repository', 0)
+ #
+ test.writable('repository', 0)
-#
-test.up_to_date(chdir = 'work2', options = opts, arguments = ".")
+ #
+ test.up_to_date(chdir = 'work2', options = opts, arguments = ".")
-test.write(['work2', 'bbb.c'], r"""
+ test.write(['work2', 'bbb.c'], r"""
#include <stdio.h>
#include <stdlib.h>
void
@@ -178,25 +180,25 @@ bbb(void)
}
""")
-test.run(chdir = 'work2', options = opts, arguments = ".",
- stderr=TestSCons.noisy_ar,
- match=TestSCons.match_re_dotall)
+ test.run(chdir = 'work2', options = opts, arguments = ".",
+ stderr=TestSCons.noisy_ar,
+ match=TestSCons.match_re_dotall)
-test.run(program = work2_foo, stdout =
+ test.run(program = work2_foo, stdout =
"""repository/aaa.c
work2/bbb.c
repository/foo.c
""")
-test.fail_test(os.path.exists(work2_aaa_obj))
-test.fail_test(os.path.exists(work2_foo_obj))
+ test.fail_test(os.path.exists(work2_aaa_obj))
+ test.fail_test(os.path.exists(work2_foo_obj))
-test.up_to_date(chdir = 'work2', options = opts, arguments = ".")
+ test.up_to_date(chdir = 'work2', options = opts, arguments = ".")
-#
-test.up_to_date(chdir = 'work3', options = opts, arguments = ".")
+ #
+ test.up_to_date(chdir = 'work3', options = opts, arguments = ".")
-test.write(['work3', 'foo.c'], r"""
+ test.write(['work3', 'foo.c'], r"""
#include <stdio.h>
#include <stdlib.h>
extern void aaa(void);
@@ -212,18 +214,19 @@ main(int argc, char *argv[])
}
""")
-test.run(chdir = 'work3', options = opts, arguments = ".")
+ test.run(chdir = 'work3', options = opts, arguments = ".")
-test.run(program = work3_foo, stdout =
+ test.run(program = work3_foo, stdout =
"""repository/aaa.c
repository/bbb.c
work3/foo.c
""")
-test.fail_test(os.path.exists(work3_aaa_obj))
-test.fail_test(os.path.exists(work3_bbb_obj))
+ test.fail_test(os.path.exists(work3_aaa_obj))
+ test.fail_test(os.path.exists(work3_bbb_obj))
+
+ test.up_to_date(chdir = 'work3', options = opts, arguments = ".")
-test.up_to_date(chdir = 'work3', options = opts, arguments = ".")
#
test.pass_test()