WDT_TESTS := $(basename $(notdir $(wildcard wdriver/wdt-*.rs)))
-wdt: $(foreach f, $(WDT_TESTS), stamp/$f.check)
+WDT_LANDSCAPE_TESTS = wdt-altergame
-stamp/wdt-%.check: wdriver/run1 stamp/cargo.debug stamp/cargo-wdt.debug \
- $(FILEASSETS) templates/script.js $(LIBRARY_FILES)
+wdt: $(foreach f, $(WDT_TESTS), stamp/$f.check) \
+ $(foreach f, $(WDT_LANDSCAPE_TESTS), stamp/$f.lcheck) \
+
+WDT_DEPS = wdriver/run1 stamp/cargo.debug stamp/cargo-wdt.debug \
+ $(FILEASSETS) templates/script.js $(LIBRARY_FILES)
+
+stamp/wdt-%.check: $(WDT_DEPS)
$(NAILING_CARGO_JUST_RUN) $(abspath $<) $(basename $(notdir $@))
$(stamp)
+stamp/wdt-%.lcheck: $(WDT_DEPS)
+ $(NAILING_CARGO_JUST_RUN) $(abspath $<) $(basename $(notdir $@)) --as-if=lwdt-$* --layout=Landscape
+ $(stamp)
+
#---------- deployment ----------
DEPLOY_USER=ian@login.chiark.greenend.org.uk
type PL = PresentationLayout;
-pub struct AbbrevPresentationLayout(pub PresentationLayout);
-
-impl<'r> FromParam<'r> for AbbrevPresentationLayout {
- type Error = ();
- #[throws(Self::Error)]
- fn from_param(param: &'r RawStr) -> Self {
- AbbrevPresentationLayout(match param.as_str() {
- "p" => PL::Portrait,
- "l" => PL::Landscape,
- _ => throw!(())
- })
- }
-}
-
#[derive(Clone,Debug)]
pub struct InstanceAccess<'i, Id> {
pub raw_token: &'i RawTokenVal,
pub use rocket_contrib::templates::Engines;
pub use rocket_contrib::templates::Template;
-pub use crate::api::{AbbrevPresentationLayout, InstanceAccess};
+pub use crate::api::InstanceAccess;
pub use crate::api::{OnlineErrorResponse};
pub use crate::cmdlistener::*;
}
#[get("/<layout>")]
#[throws(OER)]
-fn loading_l(layout: AbbrevPresentationLayout, ia: PlayerQueryString)
+fn loading_l(layout: Parse<AbbrevPresentationLayout>, ia: PlayerQueryString)
-> Template {
- loading(Some(layout.0), ia)?
+ loading(Some((layout.0).0), ia)?
}
#[throws(OE)]
fn default() -> Self { PL::Portrait }
}
+pub struct AbbrevPresentationLayout(pub PresentationLayout);
+
+impl FromStr for AbbrevPresentationLayout {
+ type Err = ();
+ #[throws(Self::Err)]
+ fn from_str(s: &str) -> Self {
+ AbbrevPresentationLayout(match s {
+ "p" => PL::Portrait,
+ "l" => PL::Landscape,
+ _ => throw!(())
+ })
+ }
+}
+
+impl Display for AbbrevPresentationLayout {
+ #[throws(fmt::Error)]
+ fn fmt(&self, f: &mut fmt::Formatter) {
+ f.write_str(match self.0 {
+ PL::Portrait => "p",
+ PL::Landscape => "l",
+ })?
+ }
+}
pub use otter::global::InstanceName;
pub use otter::mgmtchannel::MgmtChannel;
pub use otter::spec::{Coord, Pos, PosC};
+pub use otter::ui::{AbbrevPresentationLayout, PresentationLayout};
pub type T4d = t4::WebDriver;
pub type WDE = t4::error::WebDriverError;
#[derive(Debug,Clone)]
#[derive(StructOpt)]
-struct Opts {
+pub struct Opts {
#[structopt(long="--no-bwrap")]
no_bwrap: bool,
#[structopt(long="--tmp-dir", default_value="tmp")]
tmp_dir: String,
+ #[structopt(long="--as-if")]
+ as_if: Option<String>,
+
#[structopt(long="--pause", default_value="0ms")]
pause: humantime::Duration,
+ #[structopt(long="--layout", default_value="Portrait")]
+ layout: PresentationLayout,
+
#[structopt(long="--geckodriver-args", default_value="")]
geckodriver_args: String,
}
pub struct Setup {
pub ds: DirSubst,
pub mgmt_conn: MgmtChannel,
+ pub opts: Opts,
driver: T4d,
current_window: WindowState,
screenshot_count: ScreenShotCount,
}
#[throws(AE)]
-fn prepare_tmpdir(opts: &Opts, current_exe: &str) -> DirSubst {
+fn prepare_tmpdir<'x>(opts: &'x Opts, mut current_exe: &'x str) -> DirSubst {
#[throws(AE)]
fn getcwd() -> String {
env::current_dir()
.to_owned()
}
+ if let Some(as_if) = &opts.as_if {
+ current_exe = as_if;
+ }
+
let start_dir = getcwd()
.context("canonicalise our invocation directory (getcwd)")?;
ds,
mgmt_conn,
driver,
+ opts,
screenshot_count,
current_window: None,
windows_squirreled,
fn mk(su: &mut Setup, instance: &Instance, u: StaticUser) -> Window {
let nick: &str = u.into();
let token = u.get_str("Token").expect("StaticUser missing Token");
- let subst = su.ds.also([("nick", nick),
- ("token", token)].iter());
+ let pl = AbbrevPresentationLayout(su.opts.layout).to_string();
+ let subst = su.ds.also([
+ ("nick", nick),
+ ("token", token),
+ ("pl", &pl),
+ ].iter());
su.ds.otter(&subst
.ss("--super \
--account server:@nick@ \
--fixed-token @token@ \
join-game server::dummy")?)?;
let w = su.new_window(instance, nick)?;
- let url = subst.subst("@url@/?@token@")?;
+ let url = subst.subst("@url@/@pl@?@token@")?;
su.w(&w)?.get(url)?;
su.w(&w)?.screenshot("initial")?;
w
#!/bin/bash
set -e
-tname="$1";
+tname="$1"; shift;
mkdir -p tmp
-target/debug/"$tname" 2>&1 | ts -s %.s >tmp/"$tname".log
+lname="$tname"
+case "$1" in
+--as-if=*) lname="${1#--as-if}";;
+esac
+lname="$lname.log"
+
+target/debug/"$tname" "$@" 2>&1 | ts -s %.s >tmp/"$lname"
case "${PIPESTATUS[*]}" in
"0 0") exit 0;
esac
- <tmp/"$tname".log \
- tail -40
+tail -40 <tmp/"$lname"
exit 1