aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-02-24 16:34:53 +0000
committerChristopher Baines <mail@cbaines.net>2020-02-24 19:00:46 +0000
commit1f51ad1baaafd9a2d621a7682900a373356835db (patch)
tree8a71a571ef436de73454b41fa762637675ab9c18
parent34a92e4c16a93a524f33a301bbc668c511cb5055 (diff)
downloaddata-service-1f51ad1baaafd9a2d621a7682900a373356835db.tar
data-service-1f51ad1baaafd9a2d621a7682900a373356835db.tar.gz
WIP
-rw-r--r--.envrc5
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac2
-rw-r--r--guile.am4
-rw-r--r--guix-dev.scm30
-rw-r--r--tests/jobs-load-new-guix-revision.scm90
-rw-r--r--tests/model-license-set.scm2
7 files changed, 81 insertions, 54 deletions
diff --git a/.envrc b/.envrc
index 1ace49a..b5152a7 100644
--- a/.envrc
+++ b/.envrc
@@ -1,6 +1,9 @@
+export GUILE_LOAD_PATH=""
+export GUILE_LOAD_COMPILED_PATH=""
+
use guix -l guix-dev.scm --ad-hoc postgresql
-export GUILE_LOAD_COMPILED_PATH="$PWD:$GUILE_LOAD_COMPILED_PATH"
+export GUILE_LOAD_COMPILED_PATH="$PWD:$PWD/tests:$GUILE_LOAD_COMPILED_PATH"
export GUILE_LOAD_PATH="$PWD:$GUILE_LOAD_PATH"
export PATH="$PWD/scripts:$PATH"
diff --git a/Makefile.am b/Makefile.am
index c233372..85c4c32 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -145,4 +145,4 @@ SCM_LOG_DRIVER = $(top_builddir)/test-env \
$(GUILE) --no-auto-compile -e main \
$(top_srcdir)/build-aux/test-driver.scm
-AM_SCM_LOG_DRIVER_FLAGS = --brief=yes
+# AM_SCM_LOG_DRIVER_FLAGS = --brief=yes
diff --git a/configure.ac b/configure.ac
index 996ba26..19a31dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@ AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([gnu color-tests -Wall -Wno-portability foreign])
AM_SILENT_RULES([yes])
-GUILE_PKG([2.2])
+GUILE_PKG([3.0 2.2])
GUILE_PROGS
if test "x$GUILD" = "x"; then
AC_MSG_ERROR(['guild' binary not found; please check your guile-2.2 installation.])
diff --git a/guile.am b/guile.am
index c89d935..57062bd 100644
--- a/guile.am
+++ b/guile.am
@@ -1,4 +1,6 @@
-GOBJECTS = $(SOURCES:%.scm=%.go)
+ALL_SOURCES = $(SOURCES) $(TESTS)
+
+GOBJECTS = $(ALL_SOURCES:%.scm=%.go)
nobase_mod_DATA = $(SOURCES) $(NOCOMP_SOURCES)
nobase_go_DATA = $(GOBJECTS)
diff --git a/guix-dev.scm b/guix-dev.scm
index 3561b32..6c8c2b6 100644
--- a/guix-dev.scm
+++ b/guix-dev.scm
@@ -41,20 +41,34 @@
(gnu packages ruby)
(srfi srfi-1))
+(define guile3.0-email
+ (package
+ (inherit guile-email)
+ (name "guile3.0-email")
+ (inputs `(("guile" ,guile-3.0)
+ ,@(alist-delete "guile" (package-inputs guile-email))))))
+
+(define guile3.0-squee
+ (package
+ (inherit guile-squee)
+ (name "guile3.0-squee")
+ (native-inputs `(("guile" ,guile-3.0)
+ ,@(alist-delete "guile" (package-native-inputs guile-squee))))))
+
(package
(name "guix-data-service")
(version "0.0.0")
(source #f)
(build-system gnu-build-system)
(inputs
- `(("guix" ,guix)
- ("guile-email" ,guile-email)
- ("guile-json" ,guile-json-3)
- ("guile-squee" ,guile-squee)
- ("guile-fibers" ,guile-fibers)
- ("guile-gcrypt" ,guile-gcrypt)
- ("guile-syntax-highlight" ,guile-syntax-highlight)
- ("guile" ,guile-2.2)
+ `(("guix" ,guile3.0-guix)
+ ("guile-email" ,guile3.0-email)
+ ("guile-json" ,guile3.0-json)
+ ("guile-squee" ,guile3.0-squee)
+ ("guile-fibers" ,guile3.0-fibers)
+ ("guile-gcrypt" ,guile3.0-gcrypt)
+ ("guile-readline" ,guile3.0-readline)
+ ("guile" ,guile-next)
("sqitch" ,sqitch)))
(native-inputs
`(("autoconf" ,autoconf)
diff --git a/tests/jobs-load-new-guix-revision.scm b/tests/jobs-load-new-guix-revision.scm
index fc571dc..8f8f3e9 100644
--- a/tests/jobs-load-new-guix-revision.scm
+++ b/tests/jobs-load-new-guix-revision.scm
@@ -6,7 +6,6 @@
#:use-module (guix store)
#:use-module (guix tests)
#:use-module (guix-data-service database)
- #:use-module (tests mock-inferior)
#:use-module (guix-data-service model git-repository)
#:use-module (guix-data-service jobs load-new-guix-revision))
@@ -14,6 +13,13 @@
(%daemon-socket-uri "/var/empty/doesnotexist")
+(define (call-with-backtrace thunk)
+ (with-exception-handler
+ (lambda (exn)
+ (backtrace)
+ (raise-exception exn))
+ thunk))
+
(with-postgresql-connection
"test-jobs-load-new-guix-revision"
(lambda (conn)
@@ -28,52 +34,54 @@
(test-equal "test job success"
#t
- (mock
- ((guix-data-service jobs load-new-guix-revision)
- with-store-connection
- (lambda (f)
- (f 'fake-store-connection)))
-
- (mock
- ((guix-data-service jobs load-new-guix-revision)
- channel->derivations-by-system
- (lambda (conn store channel)
- '((x86_64-linux
- .
- ((manifest-entry-item . /gnu/store/foo.drv)
- (profile . /gnu/store/bar.drv))))))
-
- (mock
- ((guix-data-service jobs load-new-guix-revision)
- channel-derivations-by-system->guix-store-item
- (lambda (store channel-derivations-by-system)
- "/gnu/store/test"))
-
+ (call-with-backtrace
+ (lambda ()
(mock
((guix-data-service jobs load-new-guix-revision)
- extract-information-from
- (lambda (conn store guix-revision-id commit store-path)
- #t))
+ with-store-connection
+ (lambda (f)
+ (f 'fake-store-connection)))
(mock
- ((guix-data-service model channel-instance)
- insert-channel-instances
- (lambda (conn guix-revision-id derivations-by-system)
- #t))
+ ((guix-data-service jobs load-new-guix-revision)
+ channel->derivations-by-system
+ (lambda (conn store channel)
+ '((x86_64-linux
+ .
+ ((manifest-entry-item . /gnu/store/foo.drv)
+ (profile . /gnu/store/bar.drv))))))
(mock
- ((guix channels)
- channel-news-for-commit
- (lambda (channel commit)
- '()))
-
- (match (enqueue-load-new-guix-revision-job
- conn
- (git-repository-url->git-repository-id conn "test-url")
- "test-commit"
- "test-source")
- ((id)
- (process-load-new-guix-revision-job id))))))))))
+ ((guix-data-service jobs load-new-guix-revision)
+ channel-derivations-by-system->guix-store-item
+ (lambda (store channel-derivations-by-system)
+ "/gnu/store/test"))
+
+ (mock
+ ((guix-data-service jobs load-new-guix-revision)
+ extract-information-from
+ (lambda (conn store guix-revision-id commit store-path)
+ #t))
+
+ (mock
+ ((guix-data-service model channel-instance)
+ insert-channel-instances
+ (lambda (conn guix-revision-id derivations-by-system)
+ #t))
+
+ (mock
+ ((guix channels)
+ channel-news-for-commit
+ (lambda (channel commit)
+ '()))
+
+ (match (enqueue-load-new-guix-revision-job
+ conn
+ (git-repository-url->git-repository-id conn "test-url")
+ "test-commit"
+ "test-source")
+ ((id)
+ (process-load-new-guix-revision-job id))))))))))))
(exec-query conn "TRUNCATE guix_revisions CASCADE")
(exec-query conn "TRUNCATE load_new_guix_revision_jobs CASCADE")
diff --git a/tests/model-license-set.scm b/tests/model-license-set.scm
index efd67b6..b6141a0 100644
--- a/tests/model-license-set.scm
+++ b/tests/model-license-set.scm
@@ -6,7 +6,7 @@
#:use-module (guix-data-service model license)
#:use-module (guix-data-service model license-set))
-(use-modules (tests driver))
+;; (use-modules (tests driver))
(test-begin "test-model-license-set")