~ salmonella-environment-setup (master) ab27456e789ef9728efea4a4962504dd64fb54ac


commit ab27456e789ef9728efea4a4962504dd64fb54ac
Author:     Mario Domenech Goulart <mario.goulart@gmail.com>
AuthorDate: Mon Sep 6 21:26:18 2010 -0300
Commit:     Mario Domenech Goulart <mario.goulart@gmail.com>
CommitDate: Mon Sep 6 21:26:18 2010 -0300

    A little reorganization

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2f4ed5b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,12 @@
+CSI=csi
+
+all: index.wiki
+	$(CSI) -s ../bin/wiki2html.scm --title="CHICKEN automated tests" index.wiki > index.html
+
+install:
+	cp index.html /root/chicken-playground/root/www/salmonella-report/
+
+clean:
+	rm *~ index.html
+
+.PHONY: all install clean
diff --git a/index.wiki b/index.wiki
new file mode 100644
index 0000000..83ce1ba
--- /dev/null
+++ b/index.wiki
@@ -0,0 +1,24 @@
+== Chicken automated tests
+
+Here you can find daily results for automated tests executed for the [[http://code.call-cc.org|development version]] of Chicken and all its [[http://chicken.wiki.br/eggs|eggs]].
+
+The tests are performed by [[http://chicken.wiki.br/eggref/4/salmonella|Salmonella]] using a fresh clone of the Chicken core sources.  Salmonella runs the build process for the chicken core sources and use the freshly-built compiler to install all the eggs from the repository.
+
+Here are the results, organized by date (YYYY/MM/DD):
+
+* [[2010|2010]]
+
+The latest results can be found [[current|here]].
+
+Each daily-generated directory contains the following files and directories:
+
+* {{run-salmonella.log}}: the log of fetching and building CHICKEN from git master, and the summarized output from the execution of salmonella.
+* {{salmonella-report}}: the HTML-formatted salmonella output.  That probably is what you want to see.
+* {{salmonella.log.bz2}}: the raw salmonella output.
+
+
+=== Feeds for eggs
+
+If you want to be notified when some egg breaks, you can subscribe to the [[http://tests.call-cc.org/feeds|egg feeds]].  They are updated when the the daily testing process fails.
+
+If you have a Subversion account for the eggs repository, you can create a custom file for you which summarizes the status for all the eggs you want to follow. Take a look at one of the custom files under the [[http://www.irp.oist.jp/trac/chicken/browser/salmonella-custom-feeds|salmonella-custom-feeds]] directory.  They generate feed files at [[http://tests.call-cc.org/feeds/custom]].
\ No newline at end of file
diff --git a/run-salmonella.scm b/run-salmonella.scm
new file mode 100755
index 0000000..a783b55
--- /dev/null
+++ b/run-salmonella.scm
@@ -0,0 +1,140 @@
+#! /usr/bin/csi -s
+
+;; This script is to be run on a chroot environment
+
+(use posix utils)
+
+(define tmp-dir "/root/salmonella") ;; in the chroot env
+(define chicken-major-release 4)
+(define chicken-core-dir (make-pathname tmp-dir "chicken-core"))
+(define chicken-prefix (make-pathname tmp-dir "chicken"))
+(define chicken-bootstrap "/usr/local/chicken-4.5.2/bin/chicken")
+(define chicken-core-git-uri "http://code.call-cc.org/git/chicken-core.git")
+(define chicken-eggs-svn-uri
+  (conc "https://anonymous@code.call-cc.org/svn/chicken-eggs/release/" chicken-major-release))
+(define eggs-dir (make-pathname tmp-dir "chicken-eggs"))
+(define svn-credentials "--username anonymous --password ''")
+(define www-dir "/root/www/salmonella-report")
+(define debug-file (make-pathname tmp-dir "run-salmonella.log"))
+
+(define (debug . things)
+  (when debug-file
+    (with-output-to-file debug-file
+      (lambda ()
+	(print (string-intersperse (map ->string things) "")))
+      append:)))
+
+(define (pad-number n zeroes)
+  (define (pad num len)
+    (let ((str (if (string? num) num (number->string num))))
+      (if (string-null? str)
+	  ""
+	  (if (>= (string-length str) len)
+	      str
+	      (string-pad str len #\0)))))
+
+  (let ((len (string-length (->string n))))
+    (if (= len zeroes)
+	(number->string n)
+	(pad n zeroes))))
+
+(define (! cmd #!optional dir)
+  (let ((cmd (string-intersperse (map ->string cmd)))
+	(cwd (and dir (current-directory))))
+    (when dir
+      (change-directory dir)
+      (debug "@" dir))
+    (debug cmd)
+    (let* ((p (open-input-pipe (sprintf "~A 2>&1" cmd)))
+	   (output (read-all p))
+	   (exit-status (arithmetic-shift (close-input-pipe p) -8)))
+      (when dir (change-directory cwd))
+      (unless (zero? exit-status)
+	(debug "Comand '" cmd "' exited abnormally with status " exit-status)
+	(debug output)
+	(exit exit-status))
+      (cons exit-status output))))
+
+(define (run-salmonella)
+
+  ;; Remove previous run data
+  (for-each (lambda (file)
+	      (! `(rm -rf ,file) tmp-dir))
+	    `(chicken-prefix
+	      salmonella.log
+	      salmonella.log.bz2
+	      salmonella.progress
+	      salmonella-repo
+	      run-salmonella.log
+	      salmonella-report
+	      ,chicken-core-dir
+	      ))
+
+  ;; Get the most recent version of the chicken-core
+  (if (file-exists? chicken-core-dir)
+      (! `(git pull) chicken-core-dir)
+      (! `(git clone ,chicken-core-git-uri) tmp-dir))
+
+  ;; Get the most recent versions of all eggs
+  (if (file-exists? eggs-dir)
+      (! `(svn up ,svn-credentials) eggs-dir)
+      (! `(svn co ,svn-credentials ,chicken-eggs-svn-uri ,(pathname-strip-directory eggs-dir)) tmp-dir))
+
+  ;; Build chicken
+  (! `(make PLATFORM=linux ,(string-append "PREFIX=" chicken-prefix " CHICKEN=" chicken-bootstrap) install) chicken-core-dir)
+
+  ;; [Re]install salmonella, just in case
+  (! '(chicken-install salmonella))
+
+  ;; Run salmonella
+  (! `(,(make-pathname (pathname-directory chicken-bootstrap) "salmonella")
+       "'(dont-ask #t)'"
+       "'(verbose #f)'"
+       "'(skip-eggs (list \"macosx\" \"objc\" \"hfs+\" \"osxattr\"))'"
+       ,(string-append "'(env-vars (string-append (env-vars) \" QTDIR=/usr PATH=$PATH:" (make-pathname chicken-prefix "bin") "\"))'")
+       "'(css-file \"http://wiki.call-cc.org/chicken.css\")'"
+       ,(string-append "'(chicken-install \"" (make-pathname chicken-prefix "bin/chicken-install") "\")'")
+       ,(string-append "'(chicken-eggs-dir \"" eggs-dir "\")'"))))
+
+
+(define (publish-results)
+  (let* ((now (seconds->local-time))
+	 (day (pad-number (vector-ref now 3) 2))
+	 (month (pad-number (add1 (vector-ref now 4)) 2))
+	 (year (number->string (+ 1900 (vector-ref now 5))))
+	 (publish-dir (make-pathname (list www-dir year month) day))
+	 (feeds-dir (make-pathname www-dir "feeds"))
+	 (today-path (make-pathname (list year month) day)))
+
+    (unless (file-exists? publish-dir)
+	    (create-directory publish-dir 'parents-too))
+
+    (unless (file-exists? feeds-dir)
+	    (create-directory feeds-dir 'parents-too))
+
+    ;; Generate the atom feeds
+    (! `(csi -s ,(make-pathname (pathname-directory chicken-bootstrap) "salmonella-log2atom")
+	     salmonella.log ,feeds-dir ,today-path 1))
+
+    (! `(bzip2 -9 salmonella.log) tmp-dir)
+
+    (for-each (lambda (file)
+		(! `(cp -R ,file ,publish-dir) tmp-dir))
+	      '("salmonella.log.bz2"
+		"salmonella-report"
+		"run-salmonella.log"))
+
+    ;; Making a link for the current results
+    (! `(rm -f current) www-dir)
+    (! `(ln -s ,today-path current) www-dir)))
+
+
+;; Create the tmp dir if it not exists
+(unless (file-exists? tmp-dir)
+	(create-directory tmp-dir 'parents-too))
+
+;; Change to the tmp dir
+(change-directory tmp-dir)
+
+(run-salmonella)
+(publish-results)
Trap