Fixing typo: surce => sure
[hunchentoot.git] / run-test.lisp
blob9f05c0264df2feb954a513a212774ce1790b9220
1 ;;; -*- Mode: LISP; Syntax: COMMON-LISP; Package: HUNCHENTOOT; Base: 10 -*-
3 ;;; Copyright (c) 2011, Hans Huebner. All rights reserved.
5 ;;; Redistribution and use in source and binary forms, with or without
6 ;;; modification, are permitted provided that the following conditions
7 ;;; are met:
9 ;;; * Redistributions of source code must retain the above copyright
10 ;;; notice, this list of conditions and the following disclaimer.
12 ;;; * Redistributions in binary form must reproduce the above
13 ;;; copyright notice, this list of conditions and the following
14 ;;; disclaimer in the documentation and/or other materials
15 ;;; provided with the distribution.
17 ;;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESSED
18 ;;; OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 ;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 ;;; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
21 ;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 ;;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 ;;; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 ;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 ;;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 (in-package :cl-user)
31 (defparameter *test-port* 4241)
33 (asdf:oos 'asdf:load-op :hunchentoot-test)
35 (defun run-tests ()
36 (format t "~&;; Starting web server on localhost:~A." *test-port*)
37 (force-output)
38 (let ((server (hunchentoot:start (make-instance 'hunchentoot:easy-acceptor :port *test-port*))))
39 (unwind-protect
40 (progn
41 (format t "~&;; Sleeping 2 seconds to give the server some time to start...")
42 (force-output)
43 (sleep 2)
44 (format t "~&;; Now running confidence tests.")
45 (force-output)
46 (hunchentoot-test:test-hunchentoot (format nil "http://localhost:~A" *test-port*)))
47 (format t "~&;; Stopping server.")
48 (force-output)
49 (hunchentoot:stop server)
50 (format t "~&;; Cleaning temporary files.")
51 (hunchentoot-test::clean-tmp-dir))))
53 (run-tests)