Add a couple `swift package init` tests.

 - In particular, they check that the initial packages build and test without
   warnings.

 - Catches: https://bugs.swift.org/browse/SR-1606
diff --git a/lit.cfg b/lit.cfg
index 0c7a0c8..ea91fab 100644
--- a/lit.cfg
+++ b/lit.cfg
@@ -53,12 +53,12 @@
 # suffixes: A list of file extensions to treat as test files.
 #
 # We override this in specific subdirectories to change what we test.
-config.suffixes = [".txt", ".py"]
+config.suffixes = [".txt", ".py", ".md"]
 
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
 # subdirectories contain auxiliary inputs for various tests in their parent
 # directories.
-config.excludes = ['Inputs']
+config.excludes = ['README.md', 'CONTRIBUTING.md', 'Inputs']
 
 # test_source_root: The root path where tests are located.
 config.test_source_root = os.path.join(srcroot)
@@ -84,6 +84,7 @@
 #
 # FIXME: Eventually, when we use xcrun to launch the toolchain items, this
 # should go away.
+config.environment["HOME"] = os.getenv("HOME")
 if platform.system() == "Darwin":
     config.environment["SDKROOT"] = subprocess.check_output(
         ["xcrun", "--sdk", "macosx", "--show-sdk-path"]).strip()
diff --git a/swift-package-init-exec.md b/swift-package-init-exec.md
new file mode 100644
index 0000000..f72d21b
--- /dev/null
+++ b/swift-package-init-exec.md
@@ -0,0 +1,44 @@
+# Test `swift package init` (executable)
+
+## Create a new package with an executable target.
+
+```
+RUN: rm -rf %t.dir
+RUN: mkdir -p %t.dir/Project
+RUN: %{swift} package --chdir %t.dir/Project init=executable
+RUN: %{swift} build --chdir %t.dir/Project &> %t.build-log
+```
+
+## Check the build log.
+
+```
+RUN: %{FileCheck} --check-prefix CHECK-BUILD-LOG --input-file %t.build-log %s
+```
+
+```
+CHECK-BUILD-LOG: Compile Swift Module 'Project'
+CHECK-BUILD-LOG: Linking {{.*}}Project
+```
+
+## Verify that the tool was built and works.
+
+```
+RUN: test -x %t.dir/Project/.build/debug/Project
+RUN: %t.dir/Project/.build/debug/Project > %t.out
+RUN: %{FileCheck} --check-prefix CHECK-TOOL-OUTPUT --input-file %t.out %s
+```
+
+```
+CHECK-TOOL-OUTPUT: Hello, world!
+```
+
+## Check there were no compile errors or warnings.
+
+```
+RUN: %{FileCheck} --check-prefix CHECK-NO-WARNINGS-OR-ERRORS --input-file %t.build-log %s
+```
+
+```
+CHECK-NO-WARNINGS-OR-ERRORS-NOT: warning
+CHECK-NO-WARNINGS-OR-ERRORS-NOT: error
+```
diff --git a/swift-package-init-lib.md b/swift-package-init-lib.md
new file mode 100644
index 0000000..d63e553
--- /dev/null
+++ b/swift-package-init-lib.md
@@ -0,0 +1,46 @@
+
+# Test `swift package init` (library)
+
+## Create a new package with an executable target.
+
+```
+RUN: rm -rf %t.dir
+RUN: mkdir -p %t.dir/Project
+RUN: %{swift} package --chdir %t.dir/Project init=library
+RUN: %{swift} build --chdir %t.dir/Project &> %t.build-log
+RUN: %{swift} test --chdir %t.dir/Project &> %t.test-log
+```
+
+## Check the build log.
+
+```
+RUN: %{FileCheck} --check-prefix CHECK-BUILD-LOG --input-file %t.build-log %s
+```
+
+```
+CHECK-BUILD-LOG: Compile Swift Module 'Project'
+```
+
+## Check the test log.
+
+```
+RUN: %{FileCheck} --check-prefix CHECK-TEST-LOG --input-file %t.test-log %s
+```
+
+```
+CHECK-TEST-LOG: Compile Swift Module 'ProjectTestSuite'
+CHECK-TEST-LOG: Test Suite 'All tests' passed
+CHECK-TEST-LOG-NEXT: Executed 1 test
+```
+
+## Check there were no compile errors or warnings.
+
+```
+RUN: %{FileCheck} --check-prefix CHECK-NO-WARNINGS-OR-ERRORS --input-file %t.build-log %s
+RUN: %{FileCheck} --check-prefix CHECK-NO-WARNINGS-OR-ERRORS --input-file %t.test-log %s
+```
+
+```
+CHECK-NO-WARNINGS-OR-ERRORS-NOT: warning
+CHECK-NO-WARNINGS-OR-ERRORS-NOT: error
+```