testing around with proot
This commit is contained in:
parent
dc68851233
commit
9b17ba5fee
6 changed files with 36 additions and 5 deletions
|
@ -8,5 +8,5 @@ charset = utf-8
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
[*.nix]
|
[*.{nix,sh}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
garbageProj = import ./Cargo.nix { inherit pkgs; };
|
garbageProj = import ./Cargo.nix { inherit pkgs; };
|
||||||
|
garbageProjDebug = import ./Cargo.nix { inherit pkgs; release = false; };
|
||||||
garbage = pkgs.lib.recursiveUpdate garbageProj.rootCrate.build {
|
garbage = pkgs.lib.recursiveUpdate garbageProj.rootCrate.build {
|
||||||
meta = {
|
meta = {
|
||||||
description = "CLI tool to interact with the FreeDesktop trash API.";
|
description = "CLI tool to interact with the FreeDesktop trash API.";
|
||||||
|
@ -16,7 +17,7 @@
|
||||||
};
|
};
|
||||||
flakePkgs = {
|
flakePkgs = {
|
||||||
inherit garbage;
|
inherit garbage;
|
||||||
tests = pkgs.callPackage ./tests { inherit garbage; };
|
tests = pkgs.callPackage ./tests { garbage = garbageProjDebug.rootCrate.build; };
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
|
|
1
tests/.common.sh
Normal file
1
tests/.common.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export RUST_BACKTRACE=1
|
|
@ -1,4 +1,4 @@
|
||||||
{ stdenv, garbage }:
|
{ stdenv, garbage, pkgs }:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "garbage-tests";
|
name = "garbage-tests";
|
||||||
|
@ -7,7 +7,8 @@ stdenv.mkDerivation {
|
||||||
installPhase = "mkdir -p $out";
|
installPhase = "mkdir -p $out";
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
||||||
garbage = "${garbage}/bin/garbage";
|
buildInputs = with pkgs; [ garbage proot mktemp mount which bash ];
|
||||||
|
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
find . -executable -name "*.sh" | xargs bash
|
find . -executable -name "*.sh" | xargs bash
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
source .common.sh
|
||||||
|
|
||||||
filename=$'\377'$'\017'$'\224'$'\353'\`$'\001'
|
filename=$'\377'$'\017'$'\224'$'\353'\`$'\001'
|
||||||
touch $filename
|
touch $filename
|
||||||
|
|
||||||
$garbage put $filename
|
garbage put $filename
|
||||||
|
|
27
tests/issue-4-restore-current-partition.sh
Executable file
27
tests/issue-4-restore-current-partition.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
source .common.sh
|
||||||
|
|
||||||
|
garbage=$(which garbage)
|
||||||
|
tmproot=$(mktemp -d)
|
||||||
|
mkdir -p $tmproot/{mnt,home}
|
||||||
|
echo "delete" > $tmproot/mnt/mnt-delete
|
||||||
|
echo "delete" > touch $tmproot/home/home-delete
|
||||||
|
|
||||||
|
cat > $tmproot/run.sh << EOF
|
||||||
|
cd /mnt
|
||||||
|
ls -al
|
||||||
|
cat mnt-delete
|
||||||
|
garbage put mnt-delete
|
||||||
|
garbage list
|
||||||
|
EOF
|
||||||
|
chmod +x $tmproot/run.sh
|
||||||
|
|
||||||
|
proot \
|
||||||
|
-0 \
|
||||||
|
-r $tmproot \
|
||||||
|
-b /bin \
|
||||||
|
-b /nix \
|
||||||
|
-w / \
|
||||||
|
--kill-on-exit \
|
||||||
|
"/run.sh"
|
||||||
|
|
Loading…
Reference in a new issue