Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve testing / performance testing and CI #71

Open
idontgetoutmuch opened this issue Apr 10, 2021 · 0 comments
Open

Improve testing / performance testing and CI #71

idontgetoutmuch opened this issue Apr 10, 2021 · 0 comments

Comments

@idontgetoutmuch
Copy link
Member

At the moment I am building the current version like this

let

 myHaskellPackageOverlay = self: super: {
  myHaskellPackages = super.haskellPackages.override {
    overrides = hself: hsuper: rec {

      random-fu = self.haskell.lib.addBuildDepends (super.haskell.lib.dontHaddock (super.haskell.lib.dontCheck (
        hself.callCabal2nixWithOptions "random-fu" (builtins.fetchGit {
          url = "https://github.com/haskell-numerics/random-fu";
          rev = "68716ae55b960a978866991d89a024f5f1b0ba80";
          ref = "master";
        }) "--subpath random-fu" { }
      ))) [ ];

      rvar = self.haskell.lib.addBuildDepends (super.haskell.lib.dontHaddock (super.haskell.lib.dontCheck (
        hself.callCabal2nixWithOptions "rvar" (builtins.fetchGit {
          url = "https://github.com/haskell-numerics/random-fu";
          rev = "68716ae55b960a978866991d89a024f5f1b0ba80";
          ref = "master";
        }) "--subpath rvar" { }
      ))) [ ];

      random-source = self.haskell.lib.addBuildDepends (super.haskell.lib.dontHaddock (super.haskell.lib.dontCheck (
        hself.callCabal2nixWithOptions "random-source" (builtins.fetchGit {
          url = "https://github.com/haskell-numerics/random-fu";
          rev = "68716ae55b960a978866991d89a024f5f1b0ba80";
          ref = "master";
        }) "--subpath random-source" { }
      ))) [ ];

      random = self.haskell.lib.addBuildDepends (super.haskell.lib.dontHaddock (super.haskell.lib.dontCheck (
        hself.callCabal2nixWithOptions "random" (builtins.fetchGit {
          url = "https://github.com/haskell/random";
          rev = "edae4f7908f3c7e00be1094034a4a09cd72ab35e";
        }) "" { }
      ))) [ ];

      mwc-random = hself.callHackage "mwc-random" "0.15.0.1" {};

      hashable = super.haskell.lib.doJailbreak hsuper.hashable;

    };
  };
};

in

{ nixpkgs ? import <nixpkgs> { config.allowBroken = true; overlays = [ myHaskellPackageOverlay ]; }, compiler ? "default", doBenchmark ? true }:

let

orig =
  let src = builtins.fetchGit {
        url = "https://github.com/haskell-numerics/random-fu";
        rev = "68716ae55b960a978866991d89a024f5f1b0ba80";
        ref = "master";
      };
      nixSrc = nixpkgs.myHaskellPackages.callCabal2nixWithOptions "speed" src "--subpath tests/speed" { };
      newSrc = nixpkgs.pkgs.haskell.lib.doBenchmark (
        nixpkgs.haskell.lib.dontCheck (
          nixpkgs.haskell.lib.dontHaddock nixSrc
        )
      );
      preSrc = nixpkgs.haskell.lib.overrideCabal newSrc (old: {
        preConfigure = ''
                       sed -i -e s/benchmark/executable/ speed-tests.cabal
                       '';
      });
    in
      nixpkgs.myHaskellPackages.callPackage preSrc {
        random-fu     = nixpkgs.myHaskellPackages.random-fu;
        random-source = nixpkgs.myHaskellPackages.random-source;
      };

in

orig

and the proposal / PR like this

let

 myHaskellPackageOverlay = self: super: {
  myHaskellPackages = super.haskellPackages.override {
    overrides = hself: hsuper: rec {

      random-fu = self.haskell.lib.addBuildDepends (super.haskell.lib.dontHaddock (super.haskell.lib.dontCheck (
        hself.callCabal2nixWithOptions "random-fu" (builtins.fetchGit {
          url = "https://github.com/lehins/random-fu";
          rev = "23d4390dbad60ae491b12ebd2cabb7a985302b55";
          ref = "switch-to-random";
        }) "--subpath random-fu" { }
      ))) [ ];

      rvar = self.haskell.lib.addBuildDepends (super.haskell.lib.dontHaddock (super.haskell.lib.dontCheck (
        hself.callCabal2nixWithOptions "rvar" (builtins.fetchGit {
          url = "https://github.com/lehins/random-fu";
          rev = "23d4390dbad60ae491b12ebd2cabb7a985302b55";
          ref = "switch-to-random";
        }) "--subpath rvar" { }
      ))) [ ];

      random = self.haskell.lib.addBuildDepends (super.haskell.lib.dontHaddock (super.haskell.lib.dontCheck (
        hself.callCabal2nixWithOptions "rvar" (builtins.fetchGit {
          url = "https://github.com/haskell/random";
          rev = "edae4f7908f3c7e00be1094034a4a09cd72ab35e";
        }) "" { }
      ))) [ ];

      mwc-random = hself.callHackage "mwc-random" "0.15.0.1" {};

      hashable = super.haskell.lib.doJailbreak hsuper.hashable;

    };
  };
};

in

{ nixpkgs ? import <nixpkgs> { config.allowBroken = true; overlays = [ myHaskellPackageOverlay ]; }, compiler ? "default", doBenchmark ? true }:

let

orig =
  let src = builtins.fetchGit {
        url = "https://github.com/lehins/random-fu";
        rev = "23d4390dbad60ae491b12ebd2cabb7a985302b55";
        ref = "switch-to-random";
      };
      nixSrc = nixpkgs.myHaskellPackages.callCabal2nixWithOptions "speed" src "--subpath tests/speed" { };
      newSrc = nixpkgs.pkgs.haskell.lib.doBenchmark (
        nixpkgs.haskell.lib.dontCheck (
          nixpkgs.haskell.lib.dontHaddock nixSrc
        )
      );
      preSrc = nixpkgs.haskell.lib.overrideCabal newSrc (old: {
        preConfigure = ''
                       sed -i -e s/benchmark/executable/ speed-tests.cabal
                       '';
      });
    in
      nixpkgs.myHaskellPackages.callPackage preSrc {
        random-fu     = nixpkgs.myHaskellPackages.random-fu;
        random-source = nixpkgs.myHaskellPackages.random-source;
      };

in

orig

And then running the performance suite by hand and generating charts by hand. It would be nice to automate this.

Possibly run the performance tests as part of CI?

Add doctests (I think this is already being done).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant