summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorBrett Viren <brett.viren@gmail.com>2016-05-07 18:24:24 -0400
committerBrett Viren <brett.viren@gmail.com>2016-05-07 18:24:24 -0400
commit2d1430da130e33fdd8d8345ce9b4cbe3dbdc2871 (patch)
tree47d673dfa21eaad86037f38b46fa54ed0b53d60f /share
parent26c5bc9d979b95df560bdb7d7a6bd747ef93f83d (diff)
downloadspack-2d1430da130e33fdd8d8345ce9b4cbe3dbdc2871.tar.gz
spack-2d1430da130e33fdd8d8345ce9b4cbe3dbdc2871.tar.bz2
spack-2d1430da130e33fdd8d8345ce9b4cbe3dbdc2871.tar.xz
spack-2d1430da130e33fdd8d8345ce9b4cbe3dbdc2871.zip
Address all coments in @trws's latest comment in PR #869.
I addressed them by factoring the code better to follow the visitor pattern. This will allow actions to be easily added in the future. These may not even be file sytsem views. One could add actions to generate shell init scripts, JSON DAG-dumpers, GraphViz DOT file generators, etc (yes, some of these are alread in there - just to give the idea). Also added is a top-level test $ source share/spack/setup-env.sh $ ./share/spack/examples/test_view.sh Read the top of that script first.
Diffstat (limited to 'share')
-rwxr-xr-xshare/spack/examples/test_view.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/share/spack/examples/test_view.sh b/share/spack/examples/test_view.sh
new file mode 100755
index 0000000000..b3e7102192
--- /dev/null
+++ b/share/spack/examples/test_view.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# This will install a few bogus/test packages in order to test the
+# `spack view` command. It assumes you have "spack" in your path.
+
+# It makes sub-directories in your CWD and installs and uninstalls
+# Spack packages named test-*.
+
+set -x
+set -e
+
+view="spack -m view -v"
+for variant in +nom ~nom+var +nom+var
+do
+ spack -m uninstall -f -a -y test-d
+ spack -m install test-d$variant
+ testdir=test_view
+ rm -rf $testdir
+ echo "hardlink may fail if Spack install area and CWD are not same FS"
+ for action in symlink hardlink
+ do
+ $view --dependencies=no $action $testdir test-d
+ $view -e test-a -e test-b $action $testdir test-d
+ $view $action $testdir test-d
+ $view status $testdir test-d
+ $view -d false remove $testdir test-a
+ $view remove $testdir test-d
+ rmdir $testdir # should not fail
+ done
+done
+echo "Warnings about skipping existing in the above are okay"