>From 8f1009556500d16b52b42620270c04d6fbbaf905 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Kochma=C5=84ski?= <daniel@turtleware.eu>
Date: Fri, 9 Sep 2016 15:03:18 +0200
Subject: [PATCH 6/9] bundle: add regression test for prebuilt systems

---
 test/ecl-prebuilt-systems.script      |  9 ++++++
 test/ecl-prebuilt-systems/hello.lisp  |  3 ++
 test/ecl-prebuilt-systems/hellow.asd  |  4 +++
 test/ecl-prebuilt-systems/readme.lisp | 59 +++++++++++++++++++++++++++++++++++
 4 files changed, 75 insertions(+)
 create mode 100644 test/ecl-prebuilt-systems.script
 create mode 100644 test/ecl-prebuilt-systems/hello.lisp
 create mode 100644 test/ecl-prebuilt-systems/hellow.asd
 create mode 100644 test/ecl-prebuilt-systems/readme.lisp

diff --git a/test/ecl-prebuilt-systems.script b/test/ecl-prebuilt-systems.script
new file mode 100644
index 0000000..62a8406
--- /dev/null
+++ b/test/ecl-prebuilt-systems.script
@@ -0,0 +1,9 @@
+;;; -*- Lisp -*-
+
+(DBG "Regression test: Test if dependencies on prebuilt libraries work.
+Should load from ecl-prebuilt-systems/")
+
+#+(and ecl (not ecl-bytecmp))
+(progn
+  (chdir (subpathname *test-directory* "ecl-prebuilt-systems/"))
+  (load "readme.lisp"))
diff --git a/test/ecl-prebuilt-systems/hello.lisp b/test/ecl-prebuilt-systems/hello.lisp
new file mode 100644
index 0000000..dba21f6
--- /dev/null
+++ b/test/ecl-prebuilt-systems/hello.lisp
@@ -0,0 +1,3 @@
+(in-package #:cl-user)
+
+(print `(:asdf-version ,(asdf:asdf-version)))
diff --git a/test/ecl-prebuilt-systems/hellow.asd b/test/ecl-prebuilt-systems/hellow.asd
new file mode 100644
index 0000000..b418b32
--- /dev/null
+++ b/test/ecl-prebuilt-systems/hellow.asd
@@ -0,0 +1,4 @@
+(asdf:defsystem #:hellow
+  :serial t
+  :depends-on (#:asdf)
+  :components ((:file "hello")))
diff --git a/test/ecl-prebuilt-systems/readme.lisp b/test/ecl-prebuilt-systems/readme.lisp
new file mode 100644
index 0000000..e37e8ca
--- /dev/null
+++ b/test/ecl-prebuilt-systems/readme.lisp
@@ -0,0 +1,59 @@
+;;;
+;;; DESCRIPTION:
+;;;
+;;; This file builds a standalone executable with a dependency on
+;;; ASDF.
+;;;
+;;;
+;;; USE:
+;;;
+;;; Launch a copy of ECL and load this file in it
+;;;
+;;;	(load "readme.lisp")
+;;;
+(require 'asdf)
+
+(format t "
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; BUILDING A STANDALONE EXECUTABLE
+;;;
+")
+
+;;
+;; * Combine files in a standalone executable. We reuse the files
+;;   from the previous example
+;;
+
+(defconstant +standalone-exe+ (compile-file-pathname "hellow" :type :program))
+
+(push (make-pathname :name nil :type nil :version nil
+                     :defaults *load-truename*)
+      asdf:*central-registry*)
+
+(asdf:make-build :hellow
+                 :type :program
+                 :move-here "./"
+                 :prologue-code "printf(\"Good morning sunshine!\");"
+                 :epilogue-code '(progn
+                                  (format t "~%Good bye sunshine.~%")
+                                  (ext:quit 0)))
+
+;;
+;; * Test the program
+;;
+(format t "
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; TESTING A STANDALONE EXECUTABLE
+;;;
+
+")
+(uiop:run-program (format nil "./~A" +standalone-exe+) :output *standard-output*)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; CLEAN UP
+;;;
+
+(delete-file +standalone-exe+)
-- 
2.9.3

