github.com/singularityware/singularity@v3.1.1+incompatible/docs/2.x-tests/23-bootstrap_apps.sh (about) 1 #!/bin/bash 2 # 3 # Copyright (c) 2017-2018, SyLabs, Inc. All rights reserved. 4 # Copyright (c) 2017, SingularityWare, LLC. All rights reserved. 5 # Copyright (c) 2017, Vanessa Sochat. All rights reserved. 6 # 7 # See the COPYRIGHT.md file at the top-level directory of this distribution and at 8 # https://github.com/sylabs/singularity/blob/master/COPYRIGHT.md. 9 # 10 # This file is part of the Singularity Linux container project. It is subject to the license 11 # terms in the LICENSE.md file found in the top-level directory of this distribution and 12 # at https://github.com/sylabs/singularity/blob/master/LICENSE.md. No part 13 # of Singularity, including this file, may be copied, modified, propagated, or distributed 14 # except according to the terms contained in the LICENSE.md file. 15 16 . ./functions 17 18 test_init "Standard Integration Format (SCI-F) Apps bootstrap tests" 19 20 21 CONTAINER="$SINGULARITY_TESTDIR/container.img" 22 DEFFILE="$SINGULARITY_TESTDIR/example.def" 23 24 # Be consistent to bootstrap from Ubuntu 14.04 25 stest 0 grep ubuntu:14.04 ../examples/apps/Singularity 26 27 # Create the container with apps recipe 28 stest 0 cp ../examples/apps/Singularity "$DEFFILE" 29 stest 0 singularity create -F -s 568 "$CONTAINER" 30 stest 0 sudo singularity bootstrap "$CONTAINER" "$DEFFILE" 31 32 # Testing exec command 33 stest 0 singularity exec "$CONTAINER" true 34 stest 0 singularity exec "$CONTAINER" /bin/true 35 stest 1 singularity exec "$CONTAINER" false 36 stest 1 singularity exec "$CONTAINER" /bin/false 37 38 # Testing folder organization 39 stest 0 singularity exec "$CONTAINER" test -d "/scif" 40 stest 0 singularity exec "$CONTAINER" test -d "/scif/apps" 41 stest 0 singularity exec "$CONTAINER" test -d "/scif/data" 42 stest 0 singularity exec "$CONTAINER" test -d "/scif/apps/foo" 43 stest 0 singularity exec "$CONTAINER" test -d "/scif/apps/bar" 44 stest 0 singularity exec "$CONTAINER" test -f "/scif/apps/foo/filefoo.exec" 45 stest 0 singularity exec "$CONTAINER" test -f "/scif/apps/bar/filebar.exec" 46 stest 0 singularity exec "$CONTAINER" test -d "/scif/data/foo/output" 47 stest 0 singularity exec "$CONTAINER" test -d "/scif/data/foo/input" 48 49 # Metadata folder 50 stest 0 singularity exec "$CONTAINER" test -d "/scif/apps/foo/scif" 51 stest 0 singularity exec "$CONTAINER" test -d "/scif/apps/foo/scif/env" 52 stest 0 singularity exec "$CONTAINER" test -f "/scif/apps/foo/scif/Singularity" 53 stest 0 singularity exec "$CONTAINER" test -f "/scif/apps/foo/scif/env/01-base.sh" 54 stest 0 singularity exec "$CONTAINER" test -f "/scif/apps/foo/scif/labels.json" 55 stest 0 singularity exec "$CONTAINER" test -f "/scif/apps/foo/scif/runscript" 56 stest 0 singularity exec "$CONTAINER" test -f "/scif/apps/foo/scif/runscript.help" 57 58 # Testing help 59 stest 0 sh -c "singularity help '$CONTAINER' | grep 'No runscript help is defined for this image.'" 60 stest 0 sh -c "singularity help --app foo '$CONTAINER' | grep 'This is the help for foo!'" 61 stest 0 sh -c "singularity help --app bar '$CONTAINER' | grep 'No runscript help is defined for this application.'" 62 63 # Testing apps 64 stest 0 sh -c "singularity apps '$CONTAINER' | grep 'foo'" 65 stest 0 sh -c "singularity apps '$CONTAINER' | grep 'bar'" 66 67 # Testing inspect 68 stest 0 sh -c "singularity inspect --app foo '$CONTAINER' | grep HELLOTHISIS" 69 stest 0 sh -c "singularity inspect --app foo '$CONTAINER' | grep foo" 70 71 # Testing run 72 stest 0 sh -c "singularity run --app foo '$CONTAINER' | grep 'RUNNING FOO'" 73 stest 0 sh -c "singularity run --app bar '$CONTAINER' | grep 'No Singularity runscript for contained app: bar'" 74 75 test_cleanup