Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
clpm
clpm
Commits
9e6586f8
Commit
9e6586f8
authored
Oct 15, 2021
by
Eric Timmons
Browse files
Make it easier to run tests in a clean environment
parent
2950183a
Changes
4
Hide whitespace changes
Inline
Side-by-side
clpm-test.asd
View file @
9e6586f8
...
...
@@ -11,10 +11,11 @@
:description
"Tests for CLPM"
:license
"BSD-2-Clause"
:pathname
"test/"
:depends-on
(
#:parachute
#:hunchentoot
)
:depends-on
(
#:parachute
#:hunchentoot
#:alexandria
)
:serial
t
:components
((
:file
"package"
)
(
:file
"utils"
)
(
:file
"suite"
)
(
:file
"quicklisp-bundle"
)
(
:file
"tests"
)))
test/package.lisp
View file @
9e6586f8
(
cl:defpackage
#:clpm-test
(
:use
#:cl
)
(
:local-nicknames
(
#:para
#:parachute
)))
(
:local-nicknames
(
#:para
#:parachute
)
(
#:alex
#:alexandria
)))
test/quicklisp-bundle.lisp
View file @
9e6586f8
...
...
@@ -2,11 +2,15 @@
(
para:define-test
quicklisp-bundle
(
uiop:with-current-directory
((
asdf:system-relative-pathname
:clpm
"test/quicklisp-bundle/"
))
(
para:finish
(
uiop:run-program
`
(
,
*clpm*
"bundle"
"install"
"-y"
"--no-resolve"
)
:output
:interactive
:error-output
:interactive
))
(
para:finish
(
uiop:run-program
`
(
,
*clpm*
"bundle"
"exec"
"--"
"sbcl"
"--non-interactive"
"--no-userinit"
"--no-sysinit"
"--eval"
"(require :asdf)"
"--eval"
"(asdf:load-system :quicklisp-bundle)"
"--quit"
)
:output
:interactive
:error-output
:interactive
))))
(
with-clpm-env
()
(
clpm
'
(
"bundle"
"install"
"-y"
"--no-resolve"
)
:output
:interactive
:error-output
:interactive
)
(
clpm
'
(
"bundle"
"exec"
"--"
"sbcl"
"--non-interactive"
"--no-userinit"
"--no-sysinit"
"--eval"
"(require :asdf)"
"--eval"
"(asdf:load-system :quicklisp-bundle)"
"--quit"
)
:output
:interactive
:error-output
:interactive
))))
test/suite.lisp
View file @
9e6586f8
...
...
@@ -2,3 +2,24 @@
(
defvar
*clpm*
"clpm"
"How to run clpm"
)
(
defvar
*clpm-env*
nil
)
(
defun
clpm
(
command
&key
output
error-output
)
(
apply
'uiop:run-program
(
list*
*clpm*
command
)
:output
output
:error-output
error-output
(
run-program-augment-env-args
*clpm-env*
)))
(
defun
call-with-clpm-env
(
thunk
)
(
with-temporary-directory
(
cache-dir
:prefix
"clpm-test-cache"
)
(
with-temporary-directory
(
data-dir
:prefix
"clpm-test-data"
)
(
let
((
*clpm-env*
(
list
(
cons
"CLPM_DATA_DIR"
(
uiop:native-namestring
data-dir
))
(
cons
"CLPM_CACHE_DIR"
(
uiop:native-namestring
cache-dir
)))))
(
funcall
thunk
:cache-dir
cache-dir
:data-dir
data-dir
)))))
(
defmacro
with-clpm-env
((
&key
(
cache-dir
(
gensym
))
(
data-dir
(
gensym
)))
&body
body
)
`
(
call-with-clpm-env
(
lambda
(
&key
((
:cache-dir
,
cache-dir
))
((
:data-dir
,
data-dir
)))
(
declare
(
ignorable
,
cache-dir
,
data-dir
))
,@
body
)))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment