summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-10-15 13:25:38 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-10-15 13:25:38 -0500
commite9870d0b830deb0b253e5e514fc90ceee201a778 (patch)
tree244344085bdcd5ada2f187fc4579005caa51e409
parentf9850e766787d46bcae874fd4302cab0f0244e03 (diff)
downloadhorizon-e9870d0b830deb0b253e5e514fc90ceee201a778.tar.gz
horizon-e9870d0b830deb0b253e5e514fc90ceee201a778.tar.bz2
horizon-e9870d0b830deb0b253e5e514fc90ceee201a778.tar.xz
horizon-e9870d0b830deb0b253e5e514fc90ceee201a778.zip
Add many more various test cases
-rw-r--r--CMakeLists.txt2
-rw-r--r--hscript/disk.cc2
-rw-r--r--hscript/meta.cc12
-rw-r--r--hscript/network.cc2
-rw-r--r--hscript/script_v.cc28
-rw-r--r--hscript/user.cc2
-rw-r--r--tests/fixtures/0227-netconfigtype-eni.installfile6
-rw-r--r--tests/fixtures/0253-fs-hfsplus.installfile10
-rw-r--r--tests/fixtures/0254-partition-type-prep.installfile8
-rw-r--r--tests/fixtures/0255-bootloader-devonly.installfile7
-rw-r--r--tests/fixtures/0256-bootloader-arm64.installfile7
-rw-r--r--tests/fixtures/0257-bootloader-armv7.installfile7
-rw-r--r--tests/fixtures/0258-bootloader-spaces.installfile7
-rw-r--r--tests/fixtures/0259-netconfigtype-duplicate.installfile21
-rw-r--r--tests/fixtures/0260-pppoe-duplicate.installfile7
-rw-r--r--tests/fixtures/0261-arch-duplicate.installfile7
-rw-r--r--tests/fixtures/0262-version-duplicate.installfile7
-rw-r--r--tests/fixtures/0263-bootloader-duplicate.installfile8
-rw-r--r--tests/spec/simulator_spec.rb69
-rw-r--r--tests/spec/validator_spec.rb26
20 files changed, 220 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4c158e1..912654c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,7 @@ include(CheckIncludeFiles)
project(Horizon
LANGUAGES C CXX
- VERSION 0.9.0)
+ VERSION 0.9.7)
add_definitions(-DVERSTR="${PROJECT_VERSION}")
diff --git a/hscript/disk.cc b/hscript/disk.cc
index 0cc4c8f..446714e 100644
--- a/hscript/disk.cc
+++ b/hscript/disk.cc
@@ -272,9 +272,11 @@ bool Encrypt::validate() const {
return true;
}
+/* LCOV_EXCL_START */
bool Encrypt::execute() const {
return false;
}
+/* LCOV_EXCL_STOP */
/*! Parse a size string into a size and type.
diff --git a/hscript/meta.cc b/hscript/meta.cc
index 84e851a..12ed196 100644
--- a/hscript/meta.cc
+++ b/hscript/meta.cc
@@ -451,9 +451,11 @@ Key *Timezone::parseFromData(const std::string &data, const ScriptLocation &pos,
}
if(access("/usr/share/zoneinfo", X_OK) != 0) {
+ /* LCOV_EXCL_START */
if(warnings) *warnings += 1;
output_warning(pos, "timezone: can't determine validity of timezone",
"zoneinfo data is missing or inaccessible");
+ /* LCOV_EXCL_STOP */
} else {
std::string zi_path = "/usr/share/zoneinfo/" + data;
if(access(zi_path.c_str(), F_OK) != 0) {
@@ -642,9 +644,11 @@ Key *SvcEnable::parseFromData(const std::string &data,
return new SvcEnable(script, pos, svc, runlevel);
}
+/* LCOV_EXCL_START */
bool SvcEnable::validate() const {
return true; /* validation occurs during parsing */
}
+/* LCOV_EXCL_STOP */
bool SvcEnable::execute() const {
const std::string target = script->targetDirectory() +
@@ -687,9 +691,11 @@ Key *Version::parseFromData(const std::string &data,
return new Version(script, pos, data);
}
+/* LCOV_EXCL_START */
bool Version::execute() const {
return true;
}
+/* LCOV_EXCL_STOP */
const std::string my_arch(const Horizon::Script *script) {
@@ -785,8 +791,10 @@ bool Bootloader::validate() const {
const static std::set<std::string> valid_arm64 = {"grub-efi"};
valid_selection = valid_arm64.find(candidate) != valid_arm64.end();
} else if(arch == "armv7") {
+ /* LCOV_EXCL_START - unreachable atm */
const static std::set<std::string> valid_arm = {};
valid_selection = valid_arm.find(candidate) != valid_arm.end();
+ /* LCOV_EXCL_STOP */
} else if(arch == "pmmx") {
const static std::set<std::string> valid_pmmx = {"grub-bios",
"grub-efi"};
@@ -797,8 +805,10 @@ bool Bootloader::validate() const {
valid_selection = valid_x86.find(candidate) != valid_x86.end();
} else if(arch == "mips64" || arch == "mips" ||
arch == "mips64el" || arch == "mipsel") {
+ /* LCOV_EXCL_START - unreachable atm */
const static std::set<std::string> valid_mips = {};
valid_selection = valid_mips.find(candidate) != valid_mips.end();
+ /* LCOV_EXCL_STOP */
} else {
output_error(pos, "bootloader: unknown architecture", arch);
return false;
@@ -879,10 +889,12 @@ bool Bootloader::execute() const {
goto updateboot;
#endif /* HAS_INSTALL_ENV */
}
+ /* LCOV_EXCL_START */
else if(method == "iquik") {
output_error(pos, "bootloader: iQUIK is not yet supported");
return false;
}
+ /* LCOV_EXCL_STOP */
else if(method == "grub-ieee1275") {
if(script->options().test(Simulate)) {
std::cout << "apk --root " << script->targetDirectory()
diff --git a/hscript/network.cc b/hscript/network.cc
index 17fd0ea..e530da7 100644
--- a/hscript/network.cc
+++ b/hscript/network.cc
@@ -70,6 +70,7 @@ Key *NetConfigType::parseFromData(const std::string &data,
return new NetConfigType(script, pos, system);
}
+/* LCOV_EXCL_START */
bool NetConfigType::validate() const {
/* Validation takes place during parsing. */
return true;
@@ -79,6 +80,7 @@ bool NetConfigType::execute() const {
/* This key doesn't perform any action by itself. */
return true;
}
+/* LCOV_EXCL_STOP */
Key *NetAddress::parseFromData(const std::string &data,
diff --git a/hscript/script_v.cc b/hscript/script_v.cc
index 41f1756..2cd3ab9 100644
--- a/hscript/script_v.cc
+++ b/hscript/script_v.cc
@@ -115,21 +115,25 @@ bool add_default_repos(std::vector<std::unique_ptr<Repository>> &repos,
} else {
base_url += "stable/";
}
- Repository *sys_key = dynamic_cast<Repository *>(
+ Repository *sys_key = static_cast<Repository *>(
Repository::parseFromData(base_url + "system", p, nullptr, nullptr, s)
);
if(!sys_key) {
+ /* LCOV_EXCL_START - only relevant in OOM conditions */
output_error("internal", "failed to create default system repository");
return false;
+ /* LCOV_EXCL_STOP */
}
std::unique_ptr<Repository> sys_repo(sys_key);
repos.push_back(std::move(sys_repo));
- Repository *user_key = dynamic_cast<Repository *>(
+ Repository *user_key = static_cast<Repository *>(
Repository::parseFromData(base_url + "user", p, nullptr, nullptr, s)
);
if(!user_key) {
+ /* LCOV_EXCL_START - only relevant in OOM conditions */
output_error("internal", "failed to create default user repository");
return false;
+ /* LCOV_EXCL_STOP */
}
std::unique_ptr<Repository> user_repo(user_key);
repos.push_back(std::move(user_repo));
@@ -137,10 +141,10 @@ bool add_default_repos(std::vector<std::unique_ptr<Repository>> &repos,
#ifdef NON_LIBRE_FIRMWARE
/* REQ: Runner.Execute.firmware.Repository */
if(firmware) {
- Repository *fw_key = dynamic_cast<Repository *>(
+ Repository *fw_key = static_cast<Repository *>(
Repository::parseFromData(
"https://distfiles.apkfission.net/adelie/1.0/nonfree",
- {"internal", 0}, nullptr, nullptr, s
+ p, nullptr, nullptr, s
)
);
if(!fw_key) {
@@ -163,14 +167,16 @@ bool add_default_repos(std::vector<std::unique_ptr<Repository>> &repos,
*/
bool add_default_repo_keys(std::vector<std::unique_ptr<SigningKey>> &keys,
const Script *s, bool firmware = false) {
- SigningKey *key = dynamic_cast<SigningKey *>(
+ SigningKey *key = static_cast<SigningKey *>(
SigningKey::parseFromData(
"/etc/apk/keys/packages@adelielinux.org.pub",
{"internal", 0}, nullptr, nullptr, s)
);
if(!key) {
+ /* LCOV_EXCL_START - only relevant in OOM conditions */
output_error("internal", "failed to create default repository signing key");
return false;
+ /* LCOV_EXCL_STOP */
}
std::unique_ptr<SigningKey> repo_key(key);
keys.push_back(std::move(repo_key));
@@ -278,11 +284,15 @@ bool Horizon::Script::validate() const {
/* REQ: Runner.Execute.timezone */
if(!internal->tzone) {
- Timezone *utc = dynamic_cast<Timezone *>
- (Timezone::parseFromData("UTC", {"", 0}, &failures, nullptr, this));
+ Timezone *utc = static_cast<Timezone *>(
+ Timezone::parseFromData("UTC", {"internal", 0}, &failures,
+ nullptr, this)
+ );
if(!utc) {
+ /* LCOV_EXCL_START - only relevant in OOM conditions */
output_error("internal", "failed to create default timezone");
return false;
+ /* LCOV_EXCL_STOP */
}
std::unique_ptr<Timezone> zone(utc);
internal->tzone = std::move(zone);
@@ -298,7 +308,7 @@ bool Horizon::Script::validate() const {
, internal->firmware && internal->firmware->test()
#endif
)) {
- return false;
+ return false; /* LCOV_EXCL_LINE - only OOM */
}
}
@@ -320,7 +330,7 @@ bool Horizon::Script::validate() const {
, internal->firmware && internal->firmware->test()
#endif
)) {
- return false;
+ return false; /* LCOV_EXCL_LINE - only OOM */
}
}
diff --git a/hscript/user.cc b/hscript/user.cc
index 571ebc4..5a1d6cf 100644
--- a/hscript/user.cc
+++ b/hscript/user.cc
@@ -318,7 +318,7 @@ bool UserPassphrase::execute() const {
return false;
}
#endif /* HAS_INSTALL_ENV */
- return true;
+ return true; /* LCOV_EXCL_LINE */
}
diff --git a/tests/fixtures/0227-netconfigtype-eni.installfile b/tests/fixtures/0227-netconfigtype-eni.installfile
index e5beb22..0c1deda 100644
--- a/tests/fixtures/0227-netconfigtype-eni.installfile
+++ b/tests/fixtures/0227-netconfigtype-eni.installfile
@@ -2,8 +2,10 @@ hostname horizon-eni-test
rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
network true
netconfigtype eni
-netaddress eth0 static 192.168.1.2 24 192.168.1.1
-netaddress eth0 slaac
+netaddress eth0 static 192.0.2.2 24 192.0.2.1
+netaddress eth1 slaac
+netaddress eth2 dhcp
+netaddress eth3 static 2001:db8::2 64 2001:db8::1
nameserver 9.9.9.10
diskid /dev/sda QEMU_HARDDISK
disklabel /dev/sda gpt
diff --git a/tests/fixtures/0253-fs-hfsplus.installfile b/tests/fixtures/0253-fs-hfsplus.installfile
new file mode 100644
index 0000000..cf1801a
--- /dev/null
+++ b/tests/fixtures/0253-fs-hfsplus.installfile
@@ -0,0 +1,10 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+diskid /dev/sdb WDBNCE2500PNC
+disklabel /dev/sdb gpt
+partition /dev/sdb 1 10M bios
+partition /dev/sdb 2 fill
+fs /dev/sdb2 hfs+
+mount /dev/sdb2 /
diff --git a/tests/fixtures/0254-partition-type-prep.installfile b/tests/fixtures/0254-partition-type-prep.installfile
new file mode 100644
index 0000000..96cc82d
--- /dev/null
+++ b/tests/fixtures/0254-partition-type-prep.installfile
@@ -0,0 +1,8 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+diskid /dev/sdb WDBNCE2500PNC
+disklabel /dev/sdb gpt
+partition /dev/sdb 1 fill prep
+mount /dev/sdb1 /
diff --git a/tests/fixtures/0255-bootloader-devonly.installfile b/tests/fixtures/0255-bootloader-devonly.installfile
new file mode 100644
index 0000000..ab2a3e6
--- /dev/null
+++ b/tests/fixtures/0255-bootloader-devonly.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+arch ppc
+bootloader /dev/sda
diff --git a/tests/fixtures/0256-bootloader-arm64.installfile b/tests/fixtures/0256-bootloader-arm64.installfile
new file mode 100644
index 0000000..dfd5317
--- /dev/null
+++ b/tests/fixtures/0256-bootloader-arm64.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+arch aarch64
+bootloader /dev/sda
diff --git a/tests/fixtures/0257-bootloader-armv7.installfile b/tests/fixtures/0257-bootloader-armv7.installfile
new file mode 100644
index 0000000..2374ae5
--- /dev/null
+++ b/tests/fixtures/0257-bootloader-armv7.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+arch armv7
+bootloader /dev/sda
diff --git a/tests/fixtures/0258-bootloader-spaces.installfile b/tests/fixtures/0258-bootloader-spaces.installfile
new file mode 100644
index 0000000..661a439
--- /dev/null
+++ b/tests/fixtures/0258-bootloader-spaces.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+arch ppc64
+bootloader /dev/sda invalid loader
diff --git a/tests/fixtures/0259-netconfigtype-duplicate.installfile b/tests/fixtures/0259-netconfigtype-duplicate.installfile
new file mode 100644
index 0000000..08f0c91
--- /dev/null
+++ b/tests/fixtures/0259-netconfigtype-duplicate.installfile
@@ -0,0 +1,21 @@
+hostname horizon-netifrc-test
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+network true
+netconfigtype netifrc
+netconfigtype eni
+netaddress eth0 dhcp
+netaddress eth0 slaac
+nameserver 9.9.9.10
+diskid /dev/sda QEMU_HARDDISK
+disklabel /dev/sda gpt
+partition /dev/sda 1 fill
+fs /dev/sda1 ext4
+mount /dev/sda1 /
+repository https://distfiles.adelielinux.org/adelie/current/system
+repository https://distfiles.adelielinux.org/adelie/current/user
+signingkey /etc/apk/keys/packages@adelielinux.org.pub
+pkginstall adelie-base-posix dash-binsh easy-kernel-power8 easy-kernel-power8-modules grub-ieee1275 netifrc openrc s6-linux-init
+keymap us
+language en_GB.UTF-8
+timezone America/Chicago
+firmware false
diff --git a/tests/fixtures/0260-pppoe-duplicate.installfile b/tests/fixtures/0260-pppoe-duplicate.installfile
new file mode 100644
index 0000000..8bb0262
--- /dev/null
+++ b/tests/fixtures/0260-pppoe-duplicate.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+pppoe eth0
+pppoe eth0
diff --git a/tests/fixtures/0261-arch-duplicate.installfile b/tests/fixtures/0261-arch-duplicate.installfile
new file mode 100644
index 0000000..123fc09
--- /dev/null
+++ b/tests/fixtures/0261-arch-duplicate.installfile
@@ -0,0 +1,7 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+arch ppc64
+arch ppc
diff --git a/tests/fixtures/0262-version-duplicate.installfile b/tests/fixtures/0262-version-duplicate.installfile
new file mode 100644
index 0000000..a795494
--- /dev/null
+++ b/tests/fixtures/0262-version-duplicate.installfile
@@ -0,0 +1,7 @@
+network false
+hostname 123lonelycorgi.street
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+version 1.0
+version 1.1
diff --git a/tests/fixtures/0263-bootloader-duplicate.installfile b/tests/fixtures/0263-bootloader-duplicate.installfile
new file mode 100644
index 0000000..ff81cd5
--- /dev/null
+++ b/tests/fixtures/0263-bootloader-duplicate.installfile
@@ -0,0 +1,8 @@
+network false
+hostname test.machine
+pkginstall adelie-base
+rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/
+mount /dev/sda1 /
+arch ppc
+bootloader /dev/sda grub-ieee1275
+bootloader /dev/sda iquik
diff --git a/tests/spec/simulator_spec.rb b/tests/spec/simulator_spec.rb
index b2d6d4a..8c93996 100644
--- a/tests/spec/simulator_spec.rb
+++ b/tests/spec/simulator_spec.rb
@@ -100,6 +100,11 @@ RSpec.describe 'HorizonScript Simulator', :type => :aruba do
run_simulate
expect(last_command_started.stdout).to include("mkfs.ext4 -q -F /dev/sdb1")
end
+ it "creates HFS+ filesystems correctly" do
+ use_fixture '0253-fs-hfsplus.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("mkfs.hfsplus -w /dev/sdb2")
+ end
it "creates JFS filesystems correctly" do
use_fixture '0195-fs-jfs.installfile'
run_simulate
@@ -145,6 +150,29 @@ mount -o noatime /dev/gwyn/source /target/usr/src
printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >> /target/etc/fstab")
end
end
+ context "simulating 'bootloader' execution" do
+ it "installs grub-bios correctly" do
+ use_fixture '0251-bootloader-x86bios.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("add grub-bios")
+ expect(last_command_started.stdout).to include("grub-install")
+ expect(last_command_started.stdout).to include("/usr/sbin/update-boot")
+ end
+ it "installs grub-efi correctly" do
+ use_fixture '0256-bootloader-arm64.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("add grub-efi")
+ expect(last_command_started.stdout).to include("grub-install")
+ expect(last_command_started.stdout).to include("/usr/sbin/update-boot")
+ end
+ it "installs grub-ieee1275 correctly" do
+ use_fixture '0255-bootloader-devonly.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("add grub-ieee1275")
+ expect(last_command_started.stdout).to include("grub-install")
+ expect(last_command_started.stdout).to include("/usr/sbin/update-boot")
+ end
+ end
context "simulating 'hostname' execution" do
it "sets the hostname properly" do
use_fixture '0074-hostname-large.installfile'
@@ -217,15 +245,13 @@ printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >>
run_simulate
expect(last_command_started.stdout).to include("ln -s /etc/init.d/net.lo /target/etc/init.d/net.eth0")
end
- it "configures IPv4 addressing correctly with eni" do
- use_fixture '0227-netconfigtype-eni.installfile'
- run_simulate
- expect(last_command_started.stdout).to include("auto eth0\niface eth0 inet static")
- end
- it "configures IPv6 SLAAC addressing correctly with eni" do
+ it "configures addressing correctly with eni" do
use_fixture '0227-netconfigtype-eni.installfile'
run_simulate
- expect(last_command_started.stdout).to include("iface eth0 inet6 manual")
+ expect(last_command_started.stdout).to include("auto eth0\niface eth0 inet static\n\taddress 192.0.2.2")
+ expect(last_command_started.stdout).to include("auto eth1\niface eth1 inet6 manual\n\tpre-up echo 1 > /proc/sys/net/ipv6/conf/eth1/accept_ra")
+ expect(last_command_started.stdout).to include("auto eth2\niface eth2 inet dhcp")
+ expect(last_command_started.stdout).to include("auto eth3\niface eth3 inet6 static\n\tpre-up echo 0 > /proc/sys/net/ipv6/conf/eth3/accept_ra")
end
end
context "simulating 'nameserver' execution" do
@@ -257,6 +283,25 @@ printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >>
expect(last_command_started.stdout).to include("cp /target/etc/resolv.conf* /etc/")
end
end
+ context "simulating 'pppoe' execution" do
+ it "supports simulating PPPoE using netifrc" do
+ use_fixture '0243-pppoe-allkeys.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include('pppd_ppp0="noauth
+defaultroute
+lcp-echo-interval 10
+lcp-echo-failure 5
+mtu 9001
+"
+password_ppp0="fuzzball"
+username_ppp0="awilfox"
+plugins_ppp0="pppoe"
+link_ppp0="eth0"
+config_ppp0="ppp"
+rc_net_ppp0_need="eth0"
+config_eth0="null"')
+ end
+ end
context "simulating 'signingkey' execution" do
it "downloads remote keys to target" do
use_fixture '0186-signingkey-basic.installfile'
@@ -280,11 +325,11 @@ printf '%s\\t%s\\t%s\\t%s\\t0\\t0\\n' /dev/gwyn/source /usr/src auto noatime >>
run_simulate
expect(last_command_started.stdout).to include("ln -s /etc/init.d/sshd /target/etc/runlevels/default/sshd")
end
- it "handles runlevels correctly" do
- use_fixture '0239-svcenable-runlevel.installfile'
- run_simulate
- expect(last_command_started.stdout).to include("ln -s /etc/init.d/udev /target/etc/runlevels/boot/udev")
- end
+ it "handles runlevels correctly" do
+ use_fixture '0239-svcenable-runlevel.installfile'
+ run_simulate
+ expect(last_command_started.stdout).to include("ln -s /etc/init.d/udev /target/etc/runlevels/boot/udev")
+ end
end
context "simulating 'pkginstall' execution" do
# Runner.Execute.pkginstall.APKDB
diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb
index ceed3c2..2040fe0 100644
--- a/tests/spec/validator_spec.rb
+++ b/tests/spec/validator_spec.rb
@@ -937,6 +937,18 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
expect(last_command_started).to have_output(PARSER_SUCCESS)
expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
end
+ it "handles 'bios'" do
+ use_fixture '0253-fs-hfsplus.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "handles 'prep'" do
+ use_fixture '0254-partition-type-prep.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
it "handles no value" do
use_fixture '0154-partition-type-none.installfile'
run_validate
@@ -1146,6 +1158,12 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
run_validate
expect(last_command_started).to have_output(/error: .*fs.*already/)
end
+ it "succeeds with HFS+" do
+ use_fixture '0253-fs-hfsplus.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
end
context "for 'bootloader' key" do
it "succeeds with valid values" do
@@ -1165,12 +1183,20 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
use_fixture '0249-bootloader-ppc.installfile'
run_validate
expect(last_command_started).to have_output(/error: .*bootloader.*/)
+ use_fixture '0258-bootloader-spaces.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*bootloader.*/)
end
it "fails with unprepared architectures" do
use_fixture '0252-bootloader-alpha.installfile'
run_validate
expect(last_command_started).to have_output(/error: .*bootloader.*/)
end
+ it "fails when loader not specified and architecture doesn't have default" do
+ use_fixture '0257-bootloader-armv7.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*bootloader: no default.*/)
+ end
end
context "for 'keymap' key" do
it "succeeds with a simple value" do