-optc-O3
-optc-march=native
+
+-- These won't work without shelltestrunner installed in your
+-- $PATH. Maybe there is some way to tell Cabal that.
+test-suite shelltests
+ type: exitcode-stdio-1.0
+ hs-source-dirs: test
+ main-is: ShellTests.hs
+
+ build-depends:
+ base == 4.*,
+ bytestring >= 0.10,
+ cmdargs >= 0.10,
+ dns >= 1.4,
+ iproute >= 1.2,
+ parallel-io >= 0.3,
+ process >= 1.1
+
+ -- It's not entirely clear to me why I have to reproduce all of this.
+ ghc-options:
+ -Weverything
+ -Wno-implicit-prelude
+ -Wno-safe
+ -Wno-unsafe
+ -Wno-all-missed-specialisations
+ -rtsopts
+ -threaded
+ -optc-O3
+ -optc-march=native
+
+
source-repository head
type: git
location: http://gitweb.michael.orlitzky.com/haeredes.git
--- /dev/null
+module Main (main)
+where
+
+import System.Process (
+ CreateProcess( env ),
+ createProcess,
+ shell,
+ waitForProcess )
+import System.Exit ( exitWith )
+
+main :: IO ()
+main = do
+ -- Get a CreateProcess object corresponding to our shell command.
+ let createproc = shell "shelltest test/shell/*.test"
+
+ -- But clear its environment before running the command.
+ let empty_env_createproc = createproc { env = Just [] }
+
+ -- Ignore stdin/stdout/stderr...
+ (_,_,_,hproc) <- createProcess empty_env_createproc
+
+ -- Now run the ProcessHandle and exit with its result.
+ result <- waitForProcess hproc
+ exitWith result
--- /dev/null
+# Test that we get an error code upon exiting if the given --server
+# is unusable for some reason.
+
+echo "example.com" | dist/build/haeredes/haeredes --server localhost a.iana-servers.net b.iana-servers.net
+>>>2
+Bad DNS server or lookup error: IllegalDomain
+>>>= 1
--- /dev/null
+# Test the example given in the man page which shows that most DNS
+# errors are ignored.
+
+echo "example.com" | dist/build/haeredes/haeredes --timeout=1 --server 10.1.46.12 ns1.example.com
+>>>
+>>>= 0
--- /dev/null
+# Test the "example.com" example from the man page.
+
+# These are the two expected name servers, so haerdes should be quiet.
+echo "example.com" | dist/build/haeredes/haeredes a.iana-servers.net b.iana-servers.net
+>>>
+>>>= 0
--- /dev/null
+# Test the "no-append-root" example from the man page.
+
+# If you add "--no-append-root" to the previous "example.com" example
+# (without adding the trailing dot), then things go wrong.
+echo "example.com" | dist/build/haeredes/haeredes --no-append-root a.iana-servers.net b.iana-servers.net
+>>>
+Domain "example.com" delegates somewhere else: "b.iana-servers.net." "a.iana-servers.net."
+>>>= 0
+
--- /dev/null
+# Test the "not delegated" example from the man page.
+
+echo "foo.doesnt-exist" | dist/build/haeredes/haeredes
+>>>
+Domain "foo.doesnt-exist." not delegated.
+>>>= 0
--- /dev/null
+# Test the failing "orlitzky.com" example from the man page.
+
+echo "orlitzky.com" | dist/build/haeredes/haeredes dns1.viabit.com
+>>>
+Domain "orlitzky.com." delegates somewhere else: "dns2.viabit.com."
+>>>= 0
--- /dev/null
+# Test the successful "orlitzky.com" example from the man page.
+
+# These are the two expected name servers, so haerdes should be quiet.
+echo "orlitzky.com" | dist/build/haeredes/haeredes --server d.gtld-servers.net dns1.viabit.com dns2.viabit.com
+>>>
+>>>= 0