Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs-channels
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4b750d627731
Choose a base ref
...
head repository: NixOS/nixpkgs-channels
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 27c6eaa48d9b
Choose a head ref
  • 5 commits
  • 2 files changed
  • 4 contributors

Commits on Apr 29, 2018

  1. nixos/tests/keymap: improve keymap tests

    simplify tests, prevent timeouts and non-deterministic failures
    
    (cherry picked from commit 84a6e18)
    xeji committed Apr 29, 2018
    Copy the full SHA
    f0e2572 View commit details
  2. nixos/tests/keymap: wait for xdotool to succeed

    xdotool failed in rare cases when a window was already created
    but not yet decorated by the window manager.
    also prevent a (never observed but possible) race condition
    
    (cherry picked from commit 6891bda)
    xeji committed Apr 29, 2018
    Copy the full SHA
    d0de57d View commit details
  3. Merge pull request #39670 from xeji/keymap-tests-18.03

    [18.03] nixos/tests/keymap: improve keymap tests
    srhb authored Apr 29, 2018
    Copy the full SHA
    ce0d9d6 View commit details

Commits on Apr 30, 2018

  1. dbeaver: 5.0.3 -> 5.0.4

    (cherry picked from commit d0c8bf8)
    samueldr committed Apr 30, 2018
    Copy the full SHA
    fd6d360 View commit details
  2. Merge pull request #39703 from samueldr/dbeaver/18.03/5.0.4

    dbeaver: 5.0.3 -> 5.0.4 (18.03)
    Mic92 authored Apr 30, 2018
    Copy the full SHA
    27c6eaa View commit details
Showing with 47 additions and 86 deletions.
  1. +45 −84 nixos/tests/keymap.nix
  2. +2 −2 pkgs/applications/misc/dbeaver/default.nix
129 changes: 45 additions & 84 deletions nixos/tests/keymap.nix
Original file line number Diff line number Diff line change
@@ -3,116 +3,77 @@
with import ../lib/testing.nix { inherit system; };

let
readyFile = "/tmp/readerReady";
resultFile = "/tmp/readerResult";

testReader = pkgs.writeScript "test-input-reader" ''
#!${pkgs.stdenv.shell}
readInput() {
touch /tmp/reader.ready
echo "Waiting for '$1' to be typed"
read -r -n1 c
if [ "$c" = "$2" ]; then
echo "SUCCESS: Got back '$c' as expected."
echo 0 >&2
else
echo "FAIL: Expected '$2' but got '$c' instead."
echo 1 >&2
fi
}
main() {
error=0
while [ $# -gt 0 ]; do
ret="$((readInput "$2" "$3" | systemd-cat -t "$1") 2>&1)"
if [ $ret -ne 0 ]; then error=1; fi
shift 3
done
return $error
}
main "$@"; echo -n $? > /tmp/reader.exit
rm -f ${resultFile} ${resultFile}.tmp
logger "testReader: START: Waiting for $1 characters, expecting '$2'."
touch ${readyFile}
read -r -N $1 chars
rm -f ${readyFile}
if [ "$chars" == "$2" ]; then
logger -s "testReader: PASS: Got '$2' as expected." 2>${resultFile}.tmp
else
logger -s "testReader: FAIL: Expected '$2' but got '$chars'." 2>${resultFile}.tmp
fi
# rename after the file is written to prevent a race condition
mv ${resultFile}.tmp ${resultFile}
'';

mkReaderInput = testname: { qwerty, expect }: with pkgs.lib; let
lq = length qwerty;
le = length expect;
msg = "`qwerty' (${lq}) and `expect' (${le}) lists"
+ " need to be of the same length!";
result = flatten (zipListsWith (a: b: [testname a b]) qwerty expect);
in if lq != le then throw msg else result;

mkKeyboardTest = layout: { extraConfig ? {}, tests }: with pkgs.lib; let
readerInput = flatten (mapAttrsToList mkReaderInput tests);
combinedTests = foldAttrs (acc: val: acc ++ val) [] (builtins.attrValues tests);
perlStr = val: "'${escape ["'" "\\"] val}'";
perlReaderInput = concatMapStringsSep ", " perlStr readerInput;
lq = length combinedTests.qwerty;
le = length combinedTests.expect;
msg = "length mismatch between qwerty (${toString lq}) and expect (${toString le}) lists!";
send = concatMapStringsSep ", " perlStr combinedTests.qwerty;
expect = if (lq == le) then concatStrings combinedTests.expect else throw msg;

in makeTest {
name = "keymap-${layout}";

machine.services.xserver.desktopManager.xterm.enable = false;
machine.i18n.consoleKeyMap = mkOverride 900 layout;
machine.services.xserver.layout = mkOverride 900 layout;
machine.imports = [ ./common/x11.nix extraConfig ];
machine.services.xserver.displayManager.slim = {
enable = true;

# Use a custom theme in order to get best OCR results
theme = pkgs.runCommand "slim-theme-ocr" {
nativeBuildInputs = [ pkgs.imagemagick ];
} ''
mkdir "$out"
convert -size 1x1 xc:white "$out/background.jpg"
convert -size 200x100 xc:white "$out/panel.jpg"
cat > "$out/slim.theme" <<EOF
background_color #ffffff
background_style tile
input_fgcolor #000000
msg_color #000000
session_color #000000
session_font Verdana:size=16:bold
username_msg Username:
username_font Verdana:size=16:bold
username_color #000000
username_x 50%
username_y 40%
password_msg Password:
password_x 50%
password_y 40%
EOF
'';
};

testScript = ''
sub waitCatAndDelete ($) {
return $machine->succeed(
"for i in \$(seq 600); do if [ -e '$_[0]' ]; then ".
"cat '$_[0]' && rm -f '$_[0]' && exit 0; ".
"fi; sleep 0.1; done; echo timed out after 60 seconds >&2; exit 1"
);
};
sub mkTest ($$) {
my ($desc, $cmd) = @_;
my @testdata = (${perlReaderInput});
my $shellTestdata = join ' ', map { "'".s/'/'\\'''/gr."'" } @testdata;
subtest $desc, sub {
$machine->succeed("$cmd ${testReader} $shellTestdata &");
while (my ($testname, $qwerty, $expect) = splice(@testdata, 0, 3)) {
waitCatAndDelete "/tmp/reader.ready";
$machine->sendKeys($qwerty);
};
my $exitcode = waitCatAndDelete "/tmp/reader.exit";
die "tests for $desc failed" if $exitcode ne 0;
# prepare and start testReader
$machine->execute("rm -f ${readyFile} ${resultFile}");
$machine->succeed("$cmd ${testReader} ${toString le} ".q(${escapeShellArg expect} & ));
if ($desc eq "Xorg keymap") {
# make sure the xterm window is open and has focus
$machine->waitForWindow(qr/testterm/);
$machine->waitUntilSucceeds("${pkgs.xdotool}/bin/xdotool search --sync --onlyvisible --class testterm windowfocus --sync");
}
# wait for reader to be ready
$machine->waitForFile("${readyFile}");
$machine->sleep(1);
# send all keys
foreach ((${send})) { $machine->sendKeys($_); };
# wait for result and check
$machine->waitForFile("${resultFile}");
$machine->succeed("grep -q 'PASS:' ${resultFile}");
};
}
};
$machine->waitForX;
mkTest "VT keymap", "openvt -sw --";
mkTest "Xorg keymap", "DISPLAY=:0 xterm -fullscreen -e";
mkTest "Xorg keymap", "DISPLAY=:0 xterm -title testterm -class testterm -fullscreen -e";
'';
};

4 changes: 2 additions & 2 deletions pkgs/applications/misc/dbeaver/default.nix
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

stdenv.mkDerivation rec {
name = "dbeaver-ce-${version}";
version = "5.0.3";
version = "5.0.4";

desktopItem = makeDesktopItem {
name = "dbeaver";
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {

src = fetchurl {
url = "https://dbeaver.jkiss.org/files/${version}/dbeaver-ce-${version}-linux.gtk.x86_64.tar.gz";
sha256 = "0pk40jzmd23cv690a8wslxbb4xp4msq2zwh7xm0hvs64ykm9a581";
sha256 = "0dfs2xa490dypp4qz8v0wj6d2bjnfqhjmlskpzrf8ih416lz1bd3";
};

installPhase = ''