github.com/singularityware/singularity@v3.1.1+incompatible/docs/2.x-tests/28-importexport.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright (c) 2017, Michael W. Bauer. All rights reserved.
     4  # Copyright (c) 2017, Gregory M. Kurtzer. All rights reserved.
     5  #
     6  # "Singularity" Copyright (c) 2016, The Regents of the University of California,
     7  # through Lawrence Berkeley National Laboratory (subject to receipt of any
     8  # required approvals from the U.S. Dept. of Energy).  All rights reserved.
     9  #
    10  # This software is licensed under a customized 3-clause BSD license.  Please
    11  # consult LICENSE file distributed with the sources of this project regarding
    12  # your rights to use or distribute this software.
    13  #
    14  # NOTICE.  This Software was developed under funding from the U.S. Department of
    15  # Energy and the U.S. Government consequently retains certain rights. As such,
    16  # the U.S. Government has been granted for itself and others acting on its
    17  # behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software
    18  # to reproduce, distribute copies to the public, prepare derivative works, and
    19  # perform publicly and display publicly, and to permit other to do so.
    20  #
    21  #
    22  
    23  
    24  
    25  . ./functions
    26  
    27  test_init "Import/Export tests"
    28  
    29  
    30  
    31  CONTAINER="$SINGULARITY_TESTDIR/container.img"
    32  
    33  stest 0 touch "$SINGULARITY_TESTDIR/hello_world"
    34  stest 0 singularity image.create -s 32 "$CONTAINER"
    35  stest 0 sh -c "tar cf - -C $SINGULARITY_TESTDIR hello_world | sudo singularity image.import $CONTAINER"
    36  stest 0 /bin/rm "$SINGULARITY_TESTDIR/hello_world"
    37  stest 0 sh -c "singularity image.export $CONTAINER | tar xf - -C $SINGULARITY_TESTDIR"
    38  stest 0 test -f "$SINGULARITY_TESTDIR/hello_world"
    39  
    40  test_cleanup