Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nora Puchreiner
Nix
Commits
4cde04f4
Unverified
Commit
4cde04f4
authored
7 years ago
by
Eelco Dolstra
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for "nix run"
parent
f5f29dc2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/local.mk
+2
-1
2 additions, 1 deletion
tests/local.mk
tests/run.nix
+17
-0
17 additions, 0 deletions
tests/run.nix
tests/run.sh
+27
-0
27 additions, 0 deletions
tests/run.sh
with
46 additions
and
1 deletion
tests/local.mk
+
2
−
1
View file @
4cde04f4
...
...
@@ -18,7 +18,8 @@ nix_tests = \
structured-attrs.sh
\
fetchGit.sh
\
fetchMercurial.sh
\
signing.sh
signing.sh
\
run.sh
# parallel.sh
install-tests
+=
$(
foreach x,
$(
nix_tests
)
, tests/
$(
x
))
...
...
This diff is collapsed.
Click to expand it.
tests/run.nix
0 → 100644
+
17
−
0
View file @
4cde04f4
with
import
./config.nix
;
{
hello
=
mkDerivation
{
name
=
"hello"
;
buildCommand
=
''
mkdir -p $out/bin
cat > $out/bin/hello <<EOF
#!
${
shell
}
who=\$1
echo "Hello \
''$
{who:-World} from $out/bin/hello"
EOF
chmod +x $out/bin/hello
''
;
};
}
This diff is collapsed.
Click to expand it.
tests/run.sh
0 → 100644
+
27
−
0
View file @
4cde04f4
source
common.sh
clearStore
clearCache
nix run
-f
run.nix hello
-c
hello |
grep
'Hello World'
nix run
-f
run.nix hello
-c
hello NixOS |
grep
'Hello NixOS'
if
[[
$(
uname
)
=
Linux
]]
;
then
chmod
-R
u+w
$TEST_ROOT
/store0
||
true
rm
-rf
$TEST_ROOT
/store0
clearStore
path
=
$(
nix
eval
--raw
-f
run.nix hello
)
# Note: we need the sandbox paths to ensure that the shell is
# visible in the sandbox.
nix run
--sandbox-paths
'/nix? /bin? /lib? /usr?'
--store
$TEST_ROOT
/store0
-f
run.nix hello
-c
hello |
grep
'Hello World'
path2
=
$(
nix run
--sandbox-paths
'/nix? /bin? /lib? /usr?'
--store
$TEST_ROOT
/store0
-f
run.nix hello
-c
$SHELL
-c
'type -p hello'
)
[[
$path
/bin/hello
=
$path2
]]
[[
-e
$TEST_ROOT
/store0/nix/store/
$(
basename
$path
)
/bin/hello
]]
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment