-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modernizes unit tests from tg (#2163)
- Loading branch information
Showing
59 changed files
with
817 additions
and
1,099 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# This is a reusable workflow to run unit tests on a single map. | ||
# This is run for every single map in ci_suite.yml. You might want to edit that instead. | ||
name: Run Unit Tests | ||
on: | ||
workflow_call: | ||
inputs: | ||
map: | ||
required: true | ||
type: string | ||
major: | ||
required: false | ||
type: string | ||
minor: | ||
required: false | ||
type: string | ||
jobs: | ||
run_unit_tests: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Restore BYOND cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/BYOND | ||
key: ${{ runner.os }}-byond-${{ secrets.CACHE_PURGE_KEY }} | ||
- name: Install rust-g | ||
run: | | ||
sudo dpkg --add-architecture i386 | ||
sudo apt update || true | ||
sudo apt install -o APT::Immediate-Configure=false libssl1.1:i386 | ||
bash tools/ci/install_rust_g.sh | ||
- name: Configure version | ||
run: | | ||
echo "BYOND_MAJOR=${{ inputs.major }}" >> $GITHUB_ENV | ||
echo "BYOND_MINOR=${{ inputs.minor }}" >> $GITHUB_ENV | ||
if: ${{ inputs.major }} | ||
- name: Compile Tests | ||
run: | | ||
bash tools/ci/install_byond.sh | ||
source $HOME/BYOND/byond/bin/byondsetup | ||
tools/build/build --ci dm -DCIBUILDING -DANSICOLORS | ||
- name: Run Tests | ||
run: | | ||
source $HOME/BYOND/byond/bin/byondsetup | ||
bash tools/ci/run_server.sh ${{ inputs.map }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/// Are tests enabled with no focus? | ||
/// Use this when performing test assertions outside of a unit test, | ||
/// since a focused test means that you're trying to run a test quickly. | ||
/// If a parameter is provided, will check if the focus is on that test name. | ||
/// For example, PERFORM_ALL_TESTS(log_mapping) will only run if either | ||
/// no test is focused, or the focus is log_mapping. | ||
#ifdef UNIT_TESTS | ||
// Bit of a trick here, if focus isn't passed in then it'll check for /datum/unit_test/, which is never the case. | ||
#define PERFORM_ALL_TESTS(focus...) (isnull(GLOB.focused_test) || GLOB.focused_test == /datum/unit_test/##focus) | ||
#else | ||
// UNLINT necessary here so that if (PERFORM_ALL_TESTS()) works | ||
#define PERFORM_ALL_TESTS(...) UNLINT(FALSE) | ||
#endif | ||
|
||
/// ASSERT(), but it only actually does anything during unit tests | ||
#ifdef UNIT_TESTS | ||
#define TEST_ONLY_ASSERT(test, explanation) if(!(test)) {CRASH(explanation)} | ||
#else | ||
#define TEST_ONLY_ASSERT(test, explanation) | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.