Skip to content

Commit

Permalink
Move UI testing framework to project folder
Browse files Browse the repository at this point in the history
  • Loading branch information
fmease committed Apr 28, 2023
1 parent 0e0a216 commit 4066ed8
Show file tree
Hide file tree
Showing 351 changed files with 93 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
run: cargo test --workspace --exclude codegen_llvm --features cranelift,lsp
- name: Run UI tests
# @Task test with LLVM and Cranelift
run: ./test/ui/run --release --timeout=20
run: ./test/run ui --release --timeout=20

test-on-windows:
name: Run tests on Windows
Expand All @@ -86,7 +86,7 @@ jobs:
run: cargo test --workspace --exclude codegen_llvm --features cranelift,lsp
- name: Run UI tests
# @Task build with LLVM and Cranelift
run: ./tests/ui/run --release --timeout=20
run: ./test/run ui --release --timeout=20

build-documentation:
name: Build documentation (on Linux)
Expand Down
40 changes: 20 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ cargo-features = ["profile-rustflags"]
members = [
"compiler/*",
"project/library/*",
"project/tool/*",
"library/core/source/boot",
"test/ui/framework",
]
default-members = ["compiler/main"]
resolver = "2"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[package]
name = "golden-ui-testing-framework"
name = "ui_test_framework"
version = "0.1.0"
description = "The golden UI testing framework for the compiler"
description = "A golden UI testing framework for the Lushui compiler"
edition = "2021"
publish = false

[dependencies]
clap = { version = "4.1.8", features = ["deprecated", "string"] }
colored = "2.0.0"
derivation = { path = "../../../project/library/derivation" }
derivation = { path = "../../library/derivation" }
diagnostics = { path = "../../../compiler/diagnostics" }
difference = "2.0.0"
joinery = "3.1.0"
lexer = { path = "../../../compiler/lexer" }
pathdiff = "0.2.1"
recnot = { path = "../../../project/library/recnot" }
recnot = { path = "../../library/recnot" }
span = { path = "../../../compiler/span" }
terminal_size = "0.2.5"
unicode-width = "0.1.10"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ mod path {
pub(crate) fn test_folder() -> &'static str {
static PATH: LazyLock<String> = LazyLock::new(|| {
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../test")
.join("../../../test/ui")
.canonicalize()
.unwrap()
.to_str()
Expand Down
File renamed without changes.
File renamed without changes.
78 changes: 65 additions & 13 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,68 @@

FOLDER="$( dirname $( realpath $0 ) )"

# Run unit tests (via the rust testing framework)
cargo \
+nightly \
test \
--quiet \
--manifest-path="$FOLDER/../Cargo.toml" \
--workspace \
--all-features \
-- \
--format pretty

# Run UI tests (via the golden UI testing framework)
"$FOLDER/ui/run"
suite="$1"

case "$suite" in
all | '')
echo 'note: running all test suites'
suite=all
shift
;;
ui | unit)
shift
;;
'unit:nodoc')
suite=unit
EXTRA_CARGO_TEST_FLAGS='--all-targets'
shift
;;
'unit:doc')
suite=unit
EXTRA_CARGO_TEST_FLAGS='--doc'
shift
;;
*)
>&2 echo "error: unknown test suite ‘$suite"
>&2 echo ' available suites are ‘all’, ‘unit’, ‘unit:nodoc’, ‘unit:doc’, ‘ui’'
exit 1
esac

selected () {
if [[ $suite == all || $suite == $1 ]]; then
return 0
else
return 1
fi
}

selected "ui"
if [[ $? == 0 ]]; then
echo "note: running golden ui tests"
cargo \
+nightly \
run \
--release \
--quiet \
--manifest-path="$FOLDER/../project/tool/ui_test_framework/Cargo.toml" \
-- \
"$@"
fi

selected "unit"
if [[ $? == 0 ]]; then
echo "note: running unit tests"

cargo \
+nightly \
test \
--quiet \
--manifest-path="$FOLDER/../Cargo.toml" \
--workspace \
--all-features \
"$EXTRA_CARGO_TEST_FLAGS" \
-- \
--format pretty
fi

echo "xxx: end"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 4066ed8

Please sign in to comment.