Add a script to build every possible feature combination.

This commit is contained in:
Tom Alexander 2023-12-26 20:51:14 -05:00
parent 2911fce7cc
commit 17b81c7c72
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 47 additions and 2 deletions

View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
#
# Time running a single parse without invoking a compare with emacs.
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
: ${PROFILE:="debug"}
function main {
local features=(compare foreign_document_test tracing event_count wasm wasm_test)
ENABLED_FEATURES= for_each_combination "${features[@]}"
}
function for_each_combination {
local additional_flags=()
if [ "$PROFILE" = "dev" ] || [ "$PROFILE" = "debug" ]; then
PROFILE="debug"
else
additional_flags+=(--profile "$PROFILE")
fi
local flag=$1
shift
if [ "$#" -gt 0 ]; then
ENABLED_FEATURES="$ENABLED_FEATURES" for_each_combination "${@}"
elif [ -z "$ENABLED_FEATURES" ]; then
(cd "$DIR/../" && echo "\n\n\n========== no features ==========\n\n\n" && set -x && cargo build "${additional_flags[@]}" --no-default-features)
else
(cd "$DIR/../" && echo "\n\n\n========== ${ENABLED_FEATURES:1} ==========\n\n\n" && set -x && cargo build "${additional_flags[@]}" --no-default-features --features "${ENABLED_FEATURES:1}")
fi
ENABLED_FEATURES="$ENABLED_FEATURES,$flag"
if [ "$#" -gt 0 ]; then
ENABLED_FEATURES="$ENABLED_FEATURES" for_each_combination "${@}"
else
(cd "$DIR/../" && echo "\n\n\n========== ${ENABLED_FEATURES:1} ==========\n\n\n" && set -x && cargo build "${additional_flags[@]}" --no-default-features --features "${ENABLED_FEATURES:1}")
fi
}
main "${@}"

View File

@ -1,5 +1,3 @@
#![no_main]
use wasm::wasm_parse_org; use wasm::wasm_parse_org;
use wasm_bindgen::prelude::wasm_bindgen; use wasm_bindgen::prelude::wasm_bindgen;
@ -11,3 +9,7 @@ pub fn parse_org(org_contents: &str) -> wasm_bindgen::JsValue {
let rust_parsed = wasm_parse_org(org_contents); let rust_parsed = wasm_parse_org(org_contents);
serde_wasm_bindgen::to_value(&rust_parsed).unwrap() serde_wasm_bindgen::to_value(&rust_parsed).unwrap()
} }
fn main() -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}