From ad437eee466b225d19ae54a0df664c5c1acf700f Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 17 Sep 2013 12:49:18 -0600 Subject: [PATCH] raco pkg tests: adjust to make tests less dependent on installation In particular, instead of relying on the default scope as "user" set up an installation with an indirection that configures the scope to "user". --- pkgs/racket-pkgs/racket-test/tests/pkg/test.rkt | 8 -------- pkgs/racket-pkgs/racket-test/tests/pkg/util.rkt | 15 ++++++++++----- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/pkgs/racket-pkgs/racket-test/tests/pkg/test.rkt b/pkgs/racket-pkgs/racket-test/tests/pkg/test.rkt index bf18c471f4..4a5385cf80 100644 --- a/pkgs/racket-pkgs/racket-test/tests/pkg/test.rkt +++ b/pkgs/racket-pkgs/racket-test/tests/pkg/test.rkt @@ -29,14 +29,6 @@ (shelly-case "All tests" (for-each (λ (x) (x)) l))))) -(let ([v (getenv "PLT_PKG_NOSETUP")]) - (unless (and v (not (string=? v ""))) - (error "Set the PLT_PKG_NOSETUP environment variable before running these tests\n"))) - -(unless (equal? "user\n" (with-output-to-string - (lambda () (pkg-config-command #:installation #t "default-scope")))) - (error "Run this test suite with `user' default package scope")) - (run-tests "name" "basic" "create" "install" "permissions" diff --git a/pkgs/racket-pkgs/racket-test/tests/pkg/util.rkt b/pkgs/racket-pkgs/racket-test/tests/pkg/util.rkt index 994ae537cd..d47d413326 100644 --- a/pkgs/racket-pkgs/racket-test/tests/pkg/util.rkt +++ b/pkgs/racket-pkgs/racket-test/tests/pkg/util.rkt @@ -21,7 +21,7 @@ (and (file-exists? p) p)) -(define (with-fake-installation* t) +(define (with-fake-installation* t #:default-scope [default-scope "installation"]) (define tmp-dir (make-temporary-file ".racket.fake-installation~a" 'directory (find-system-path 'temp-dir))) @@ -41,7 +41,7 @@ "test" 'default-scope - "installation" + default-scope ;; Find existing links and packages from the ;; old configuration: @@ -150,10 +150,15 @@ (run-pkg-tests* run-pkg-tests)))))])) (define (run-pkg-tests* t) + (putenv "PLT_PKG_NOSETUP" "y") (with-servers - (with-fake-root - (parameterize ([current-directory test-directory]) - (t))))) + (with-fake-installation* + #:default-scope "user" + (lambda () + (shelly-case "setup info cache" $ "raco setup -nDKxiI --no-foreign-libs") + (with-fake-root + (parameterize ([current-directory test-directory]) + (t))))))) (define-syntax-rule (shelly-install** message pkg rm-pkg (pre ...) (more ...)) (with-fake-root