Skip to content

Commit

Permalink
Revert "test: fix stack overflow"
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Jun 2, 2023
1 parent eb4ae88 commit 68a27f8
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Run tests (Windows)
if: runner.os == 'Windows'
# HACK: The cause is unknown, but on windows, the exit code is 1 even if tests are successful.
run: cargo test --features large_thread --all --verbose -- --include-ignored
run: cargo test --features large_thread --features pre-commit --all --verbose -- --include-ignored
- name: Run tests (Other OS)
if: runner.os != 'Windows'
run: cargo test --features large_thread --all --verbose -- --include-ignored
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
- id: cargo-test
exclude: ^doc/|^.github/|^.gitmessage|.md
name: Cargo test
entry: cargo test --features large_thread -- --nocapture
entry: cargo test --features large_thread --features pre-commit -- --nocapture
language: system
pass_filenames: false
# - id: rust-clippy
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ traditional_chinese = [
]
unicode = ["erg_common/unicode", "erg_parser/unicode", "erg_compiler/unicode", "els/unicode"]
pretty = ["erg_common/pretty", "erg_parser/pretty", "erg_compiler/pretty", "els/pretty"]
pre-commit = []
large_thread = [
"erg_common/large_thread",
"erg_parser/large_thread",
Expand Down
4 changes: 4 additions & 0 deletions doc/EN/dev_guide/build_features.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Erg internal options, help (help, copyright, license, etc.) and errors are displ

The compiler makes the display rich.

## pre-commit

Used to run tests in pre-commit. It's a bug workaround.

## large_thread

Increase the thread stack size. Used for Windows execution and test execution.
Expand Down
4 changes: 4 additions & 0 deletions doc/JA/dev_guide/build_features.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Erg 内部オプション、ヘルプ (ヘルプ、著作権、ライセンス

コンパイラが表示をリッチにする。

## pre-commit

テストを実行する為に使用される。このフラグがないと特定の環境においてテストが失敗する。バグワークアラウンドである。

## large_thread

スレッドのスタックサイズを大きくする。Windowsでの実行やテスト実行のために使用される。
Expand Down
4 changes: 4 additions & 0 deletions doc/zh_CN/dev_guide/build_features.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Erg 内部选项、帮助(帮助、版权、许可证等)和错误显示为繁

使得编译器显示丰富内容

## pre-commit

用于在预提交中运行测试。这是一个bug解决方案

## large_thread

增加线程堆栈大小。用于Windows执行和测试执行
Expand Down
4 changes: 4 additions & 0 deletions doc/zh_TW/dev_guide/build_features.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ Erg 內部選項、幫助(幫助、版權、許可證等)和錯誤顯示為繁

使得編譯器顯示豐富內容

## pre-commit

用于在預提交中運行測試。這是一個bug解決方案

## large_thread

增加線程堆棧大小。用于Windows執行和測試執行
Expand Down
7 changes: 6 additions & 1 deletion tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ fn exec_fib() -> Result<(), ()> {

#[test]
fn exec_helloworld() -> Result<(), ()> {
expect_success("examples/helloworld.er", 0)
// HACK: When running the test with pre-commit, the exit code is 1 (the cause is unknown)
if cfg!(feature = "pre-commit") && cfg!(windows) {
expect_end_with("examples/helloworld.er", 1)
} else {
expect_success("examples/helloworld.er", 0)
}
}

#[test]
Expand Down

0 comments on commit 68a27f8

Please sign in to comment.