new file mode 100644
@@ -0,0 +1,77 @@
+#
+# snowpatch - continuous integration for patch-based workflows
+#
+# Copyright (C) 2016 IBM Corporation
+# Authors:
+# Russell Currey <ruscur@russell.cc>
+# Andrew Donnellan <andrew.donnellan@au1.ibm.com>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)
+# any later version.
+#
+# invalid.toml - configuration file that's missing
+#
+
+[git]
+user = "git"
+public_key = "/home/ruscur/.ssh/id_rsa.pub"
+private_key = "/home/ruscur/.ssh/id_rsa"
+
+[patchwork]
+url = "https://russell.cc/patchwork"
+port = 443 # optional
+user = "ruscur" # optional, needed for pushing results
+pass = "banana" # optional, needed for pushing results
+polling_interval = 10 # polling interval in minutes
+
+[jenkins]
+url = "https://jenkins.ozlabs.ibm.com"
+port = 443
+username = "patchwork"
+token = "33333333333333333333333333333333"
+
+[projects]
+
+ # the name of the project must be as is in patchwork
+ [projects.skiboot]
+ repository = "/home/ruscur/Documents/skiboot"
+ branches = ["master", "stable"] # branches to base from
+ test_all_branches = false
+ remote_name = "github"
+ remote_uri = "git@github.com:ruscur/skiboot.git"
+ push_results = false
+
+ [[projects.skiboot.jobs]]
+ job = "skiboot-compile-test-snowpatch"
+ remote = "GIT_REPO"
+ branch = "GIT_REF"
+
+ [[projects.skiboot.jobs]]
+ job = "skiboot-boot-test-snowpatch"
+ remote = "GIT_REPO"
+ branch = "GIT_REF"
+ artifact = "snowpatch.txt"
+
+ [projects.linuxppc-dev]
+ repository = "/home/ruscur/Documents/linux"
+ branches = ["master", "powerpc-next"]
+ # test_all_branches defaults to true
+ remote_name = "github"
+ remote_uri = "git@github.com:ruscur/linux.git"
+ push_results = false
+
+ [[projects.linuxppc-dev.jobs]]
+ # Missing mandatory field: job = "linux-build-manual"
+ remote = "GIT_REPO"
+ branch = "GIT_REF"
+ artifact = "snowpatch.txt"
+ DEFCONFIG_TO_USE = "pseries_le_defconfig"
+
+ [[projects.linuxppc-dev.jobs]]
+ job = "linux-build-manual"
+ remote = "GIT_REPO"
+ branch = "GIT_REF"
+ artifact = "snowpatch.txt"
+ DEFCONFIG_TO_USE = "ppc64le_defconfig"
@@ -104,3 +104,25 @@ pub fn parse(path: &str) -> Config {
}
}
}
+
+#[cfg(test)]
+mod test {
+ use settings::*;
+
+ #[test]
+ #[should_panic(expected = "Couldn't open config file")]
+ fn bad_path() {
+ parse("/nonexistent/config.file");
+ }
+
+ #[test]
+ fn parse_example_openpower() {
+ parse("examples/openpower.toml");
+ }
+
+ #[test]
+ #[should_panic(expected = "Could not parse configuration file, exiting")]
+ fn parse_example_invalid() {
+ parse("examples/tests/invalid.toml");
+ }
+}
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> --- v1->v2: * add invalid.toml test file --- examples/tests/invalid.toml | 77 +++++++++++++++++++++++++++++++++++++++++++++ src/settings.rs | 22 +++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 examples/tests/invalid.toml