Skip to content

Tests failing on NixOS due to bad bash path #2243

@christomel

Description

@christomel

When running make check after ./bootstrap and ./configure many tests fail to run on NixOS.

Example failure log excerpt:

FAIL: check-globals.sh
======================

../../test-driver: ./check-globals.sh: /bin/bash: bad interpreter: No such file or directory
FAIL check-globals.sh (exit status: 126)

This issue is caused by the scripts wrongly assuming that bash is at /bin/bash. This is not the case for all unix operating systems. The solution for that is to use /usr/bin/env bash instead of hardcoding the path, because the former finds the bash executable in user's PATH, wherever it may be.

Steps to reproduce on NixOS with flakes enabled:

  1. git clone https://github.com/OpenDataPlane/odp.git && cd odp
  2. nix flake init
  3. replace contents of ./flake.nix with the following
{
  description = "A very basic flake";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
  };

  outputs =
    { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
      };
    in
    {
      devShells.${system} = {
        default = pkgs.mkShell {
          packages = with pkgs; [
            libtool
            automake
            autoconf
            asciidoctor
            mscgen
            cunit
            graphviz
            valgrind
            libcli
            pkg-config
            libconfig
            libpcap
            openssl
            doxygen
            onnxruntime
            binutils
            gcc
          ];

          NIX_ENFORCE_NO_NATIVE = 0;
        };
      };

    };
}
  1. Enter nix shell using nix develop, then
./bootstrap
./configure
make check
  1. You will get the said error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions