forked from lix-project/lix
parent
2a95127732
commit
dce253ee01
|
@ -131,7 +131,7 @@ ifeq ($(HAVE_LIBCPUID), 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ENABLE_BUILD), yes)
|
ifeq ($(ENABLE_BUILD), yes)
|
||||||
nix_tests += test-libstoreconsumer.sh
|
nix_tests += test-libstoreconsumer.sh test-repl-characterization.sh
|
||||||
|
|
||||||
ifeq ($(BUILD_SHARED_LIBS), 1)
|
ifeq ($(BUILD_SHARED_LIBS), 1)
|
||||||
nix_tests += plugins.sh
|
nix_tests += plugins.sh
|
||||||
|
@ -143,6 +143,8 @@ $(d)/test-libstoreconsumer.sh.test $(d)/test-libstoreconsumer.sh.test-debug: \
|
||||||
$(d)/plugins.sh.test $(d)/plugins.sh.test-debug: \
|
$(d)/plugins.sh.test $(d)/plugins.sh.test-debug: \
|
||||||
$(buildprefix)$(d)/plugins/libplugintest.$(SO_EXT) \
|
$(buildprefix)$(d)/plugins/libplugintest.$(SO_EXT) \
|
||||||
$(buildprefix)$(d)/plugins/libplugintestfail.$(SO_EXT)
|
$(buildprefix)$(d)/plugins/libplugintestfail.$(SO_EXT)
|
||||||
|
$(d)/test-repl-characterization.sh.test $(d)/test-repl-characterization.sh.test-debug: \
|
||||||
|
$(buildprefix)$(d)/repl_characterization/test-repl-characterization
|
||||||
|
|
||||||
install-tests += $(foreach x, $(nix_tests), $(d)/$(x))
|
install-tests += $(foreach x, $(nix_tests), $(d)/$(x))
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
programs += test-repl-characterization
|
programs += test-repl-characterization
|
||||||
|
|
||||||
installcheck: test-repl-characterization_RUN
|
|
||||||
|
|
||||||
test-repl-characterization_DIR := $(d)
|
test-repl-characterization_DIR := $(d)
|
||||||
|
|
||||||
test-repl-characterization_ENV := _NIX_TEST_UNIT_DATA=$(shell realpath "$(d)")/data
|
|
||||||
|
|
||||||
# do not install
|
# do not install
|
||||||
test-repl-characterization_INSTALL_DIR :=
|
test-repl-characterization_INSTALL_DIR :=
|
||||||
|
|
||||||
test-repl-characterization_SOURCES := \
|
test-repl-characterization_SOURCES := \
|
||||||
$(wildcard $(d)/*.cc) \
|
$(wildcard $(d)/*.cc) \
|
||||||
|
|
||||||
test-repl-characterization_CXXFLAGS += -I src/libutil -I tests/unit/libutil-support
|
test-repl-characterization_CXXFLAGS += -I src/libutil -I tests/unit/libutil-support -DNIX_BIN_DIR="\"$(bindir)\""
|
||||||
|
|
||||||
test-repl-characterization_LIBS = libutil libutil-test-support
|
test-repl-characterization_LIBS = libutil libutil-test-support
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <filesystem>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -47,8 +48,10 @@ public:
|
||||||
Strings args{"--quiet", "repl", "--quiet", "--extra-experimental-features", "repl-automation"};
|
Strings args{"--quiet", "repl", "--quiet", "--extra-experimental-features", "repl-automation"};
|
||||||
args.insert(args.end(), extraArgs.begin(), extraArgs.end());
|
args.insert(args.end(), extraArgs.begin(), extraArgs.end());
|
||||||
|
|
||||||
|
auto nixBin = canonPath(getEnvNonEmpty("NIX_BIN_DIR").value_or(NIX_BIN_DIR));
|
||||||
|
|
||||||
// TODO: why the fuck does this need two --quiets
|
// TODO: why the fuck does this need two --quiets
|
||||||
auto process = RunningProcess::start("nix", args);
|
auto process = RunningProcess::start(nixBin + "/nix", args);
|
||||||
auto session = TestSession{AUTOMATION_PROMPT, std::move(process)};
|
auto session = TestSession{AUTOMATION_PROMPT, std::move(process)};
|
||||||
|
|
||||||
for (auto & bit : syntax) {
|
for (auto & bit : syntax) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "test-session.hh"
|
#include "test-session.hh"
|
||||||
#include "util.hh"
|
#include "util.hh"
|
||||||
|
@ -28,7 +29,7 @@ RunningProcess RunningProcess::start(std::string executable, Strings args)
|
||||||
procStdout.readSide.close();
|
procStdout.readSide.close();
|
||||||
if (dup2(STDOUT_FILENO, STDERR_FILENO) == -1)
|
if (dup2(STDOUT_FILENO, STDERR_FILENO) == -1)
|
||||||
throw SysError("dupping stderr");
|
throw SysError("dupping stderr");
|
||||||
execvp(executable.c_str(), stringsToCharPtrs(args).data());
|
execve(executable.c_str(), stringsToCharPtrs(args).data(), environ);
|
||||||
throw SysError("exec did not happen");
|
throw SysError("exec did not happen");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
3
tests/functional/test-repl-characterization.sh
Normal file
3
tests/functional/test-repl-characterization.sh
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
source common.sh
|
||||||
|
|
||||||
|
_NIX_TEST_UNIT_DATA=$(pwd)/repl_characterization/data ./repl_characterization/test-repl-characterization
|
Loading…
Reference in a new issue