Add OpenBSD and FreeBSD CI to Travis

This commit adds support to test all libc definitions on both OpenBSD and
FreeBSD via QEMU userspace emulation. Specially prepared images for each OS are
used which are essentially intended to run a script on startup and then exit.
Documentation has been added to the `ci/README.md` file describing this new
system.
diff --git a/libc-test/Cargo.lock b/libc-test/Cargo.lock
index f4678de..2b4a4db 100644
--- a/libc-test/Cargo.lock
+++ b/libc-test/Cargo.lock
@@ -23,7 +23,7 @@
 [[package]]
 name = "ctest"
 version = "0.1.0"
-source = "git+https://github.com/alexcrichton/ctest#4e3a8027b540b79769fcd3945a6de9f1e5edf8e0"
+source = "git+https://github.com/alexcrichton/ctest#7703b51086cce2d9a703b103d0695b36653b8cab"
 dependencies = [
  "gcc 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)",
  "syntex_syntax 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -54,19 +54,19 @@
 
 [[package]]
 name = "libc"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
+version = "0.2.4"
 
 [[package]]
 name = "libc"
 version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "log"
-version = "0.3.4"
+version = "0.3.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "libc 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -81,7 +81,7 @@
 dependencies = [
  "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
- "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
  "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/libc-test/build-generated.rs b/libc-test/build-generated.rs
new file mode 100644
index 0000000..41b5627
--- /dev/null
+++ b/libc-test/build-generated.rs
@@ -0,0 +1,15 @@
+// This build script is distinct from the standard build.rs as it is only used
+// for the BSDs which run a stripped down version. The `all.c` file is assumed
+// to have been already generated for this build script.
+
+extern crate gcc;
+
+fn main() {
+    gcc::Config::new()
+        .file("all.c")
+        .flag("-Wall")
+        .flag("-Wextra")
+        .flag("-Werror")
+        .flag("-Wno-type-limits")
+        .compile("liball.a");
+}
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 1a071e6..1982a72 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -406,5 +406,9 @@
         }
     });
 
-    cfg.generate("../src/lib.rs", "all.rs");
+    if env::var("SKIP_COMPILE").is_ok() {
+        cfg.generate_files("../src/lib.rs", "all.rs");
+    } else {
+        cfg.generate("../src/lib.rs", "all.rs");
+    }
 }
diff --git a/libc-test/generate-files/Cargo.lock b/libc-test/generate-files/Cargo.lock
new file mode 100644
index 0000000..b7a16f7
--- /dev/null
+++ b/libc-test/generate-files/Cargo.lock
@@ -0,0 +1,108 @@
+[root]
+name = "generate-files"
+version = "0.1.0"
+dependencies = [
+ "ctest 0.1.0 (git+https://github.com/alexcrichton/ctest)",
+]
+
+[[package]]
+name = "advapi32-sys"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "bitflags"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "ctest"
+version = "0.1.0"
+source = "git+https://github.com/alexcrichton/ctest#7703b51086cce2d9a703b103d0695b36653b8cab"
+dependencies = [
+ "gcc 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syntex_syntax 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gcc"
+version = "0.3.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "kernel32-sys"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "libc"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "libc"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "log"
+version = "0.3.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "rustc-serialize"
+version = "0.3.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "syntex_syntax"
+version = "0.19.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "term"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "unicode-xid"
+version = "0.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "winapi"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "winapi-build"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
diff --git a/libc-test/generate-files/Cargo.toml b/libc-test/generate-files/Cargo.toml
new file mode 100644
index 0000000..9615a63
--- /dev/null
+++ b/libc-test/generate-files/Cargo.toml
@@ -0,0 +1,16 @@
+# Cargo.toml which is used to just generate the all.{c,rs} files used to test
+# some platforms. These files are then combined with the overlay files commented
+# in the above directory as well to assemble a libc-test project which will
+# compile/run all tests.
+
+[package]
+name = "generate-files"
+version = "0.1.0"
+authors = ["Alex Crichton <alex@alexcrichton.com>"]
+
+[[bin]]
+name = "generate-files"
+path = "../build.rs"
+
+[dependencies]
+ctest = { git = "https://github.com/alexcrichton/ctest" }
diff --git a/libc-test/run-generated-Cargo.toml b/libc-test/run-generated-Cargo.toml
new file mode 100644
index 0000000..64862a5
--- /dev/null
+++ b/libc-test/run-generated-Cargo.toml
@@ -0,0 +1,19 @@
+# Note that this Cargo.toml is not used by default, it is only intended to be
+# used on the BSDs where it is too expensive to compile syntex_syntax in a QEMU
+# emulator without KVM. Scripts will move this file into place on the BSD CI.
+
+[package]
+name = "libc-test"
+version = "0.1.0"
+authors = ["Alex Crichton <alex@alexcrichton.com>"]
+build = "build-generated.rs"
+
+[dependencies]
+libc = { path = ".." }
+
+[[bin]]
+name = "libc-test"
+path = "src/main-generated.rs"
+
+[build-dependencies]
+gcc = "0.3"
diff --git a/libc-test/src/main-generated.rs b/libc-test/src/main-generated.rs
new file mode 100644
index 0000000..608fe4e
--- /dev/null
+++ b/libc-test/src/main-generated.rs
@@ -0,0 +1,9 @@
+// Note that this main file is meant to mirror `main.rs` but is only used on the
+// BSDs where the generated location of `all.rs` is slightly different
+
+#![allow(bad_style, improper_ctypes)]
+extern crate libc;
+
+use libc::*;
+
+include!("../all.rs");