Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into better-switch-errors
Browse files Browse the repository at this point in the history
# Conflicts:
#	DMCompiler/DMStandard/DefaultPragmaConfig.dm
#	OpenDreamShared/Compiler/CompilerError.cs
  • Loading branch information
wixoaGit committed Dec 20, 2023
2 parents e3a78a2 + bbadf69 commit f4dc0de
Show file tree
Hide file tree
Showing 267 changed files with 12,919 additions and 8,517 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/compiler-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ jobs:
- name: Build
run: dotnet build main/OpenDream.sln --configuration Release --no-restore /m
- name: Compile TestGame
run: main\DMCompiler\bin\Release\net7.0\DMCompiler.exe main\TestGame\environment.dme
run: main\bin\DMCompiler\DMCompiler.exe main\TestGame\environment.dme
- name: Checkout Modified /tg/station
uses: actions/checkout@v2
with:
repository: wixoaGit/tgstation
path: tg
- name: Compile Modified /tg/station
run: main\DMCompiler\bin\Release\net7.0\DMCompiler.exe tg\tgstation.dme
run: main\bin\DMCompiler\DMCompiler.exe tg\tgstation.dme
- name: Checkout 64-bit Paradise
uses: actions/checkout@v2
with:
repository: ike709/Paradise
ref: rustg_64
path: para
- name: Compile 64-bit Paradise
run: main\DMCompiler\bin\Release\net7.0\DMCompiler.exe para\paradise.dme
run: main\bin\DMCompiler\DMCompiler.exe para\paradise.dme
77 changes: 77 additions & 0 deletions .github/workflows/test-tgs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Test tgstation-server Integration

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

concurrency:
group: "tgs-${{ github.head_ref || github.run_id }}-${{ github.event_name }}"
cancel-in-progress: true

env:
OD_DOTNET_VERSION: 7
TGS_DOTNET_VERSION: 8
TGS_REFERENCE: V6 # This will break after the V6 branch gets deleted during the TGS6 release cycle. When it does, change this to `dev`

jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Disable ptrace_scope
if: matrix.os == 'ubuntu-latest'
run: echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

- name: Install gdb
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y gdb
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
${{ env.TGS_DOTNET_VERSION }}.0.x
${{ env.OD_DOTNET_VERSION }}.0.x
- name: Checkout OpenDream
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
submodules: true

- name: Pull engine updates
uses: space-wizards/[email protected]

- name: Update Engine Submodules
run: |
cd RobustToolbox/
git submodule update --init --recursive
- name: Checkout TGS
run: |
cd ..
git clone https://github.com/tgstation/tgstation-server --depth 1 --branch ${{ env.TGS_REFERENCE }}
- name: Build TGS Integration Tests
run: |
cd ../tgstation-server
dotnet build -c ReleaseNoWindows -p:TGS_HOST_NO_WEBPANEL=true tests/Tgstation.Server.Tests/Tgstation.Server.Tests.csproj
- name: Run TGS OpenDream Tests
shell: bash
run: |
cd ../tgstation-server/tests/Tgstation.Server.Tests
export TGS_TEST_OD_EXCLUSIVE=true
export TGS_TEST_OD_ENGINE_VERSION=$GITHUB_SHA
export TGS_TEST_OD_GIT_DIRECTORY="../../../../../../${{ github.event.repository.name }}"
export TGS_TEST_DATABASE_TYPE=Sqlite
export TGS_TEST_CONNECTION_STRING="Data Source=TGS.sqlite3;Mode=ReadWriteCreate"
dotnet test -c ReleaseNoWindows --no-build --filter Name=TestOpenDreamExclusiveTgsOperation --logger "GitHubActions;summary.includePassedTests=true;summary.includeSkippedTests=true" --settings ../../build/ci.runsettings --results-directory ../../TestResults
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
release/
x64/
x86/
bld/
Expand Down
4 changes: 1 addition & 3 deletions Content.IntegrationTests/Content.IntegrationTests.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
<PropertyGroup>
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
<TargetFramework>$(TargetFramework)</TargetFramework>
Expand All @@ -8,7 +7,6 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<LangVersion>11</LangVersion>
</PropertyGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
Expand Down Expand Up @@ -43,5 +41,5 @@
<Target Name="CopyDMStandardOnPublish" AfterTargets="Publish">
<Copy SourceFiles="@(DMStandard)" DestinationFiles="@(DMStandard->'$(PublishDir)\DMStandard\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Import Project="..\RobustToolbox\MSBuild\Robust.Analyzers.targets" />
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
</Project>
2 changes: 0 additions & 2 deletions Content.IntegrationTests/ContentIntegrationTest.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System;
using System.Threading.Tasks;
using OpenDreamClient;
using OpenDreamServer;
using OpenDreamShared;
using NUnit.Framework;
using OpenDreamClient.Interface;
using OpenDreamRuntime;
using Robust.Client;
using Robust.Client.WebView;
using Robust.Server;
using Robust.Shared.ContentPack;
using Robust.Shared.IoC;
Expand Down
4 changes: 0 additions & 4 deletions Content.IntegrationTests/GameTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using System.Diagnostics;
using System.Threading.Tasks;
using NUnit.Framework;
using OpenDreamRuntime;
using Robust.Server.Player;
using Robust.Shared.IoC;
using Robust.Shared.Network;

namespace Content.IntegrationTests {
[TestFixture]
Expand Down
1 change: 0 additions & 1 deletion Content.IntegrationTests/SetupCompileDM.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.IO;
using NUnit.Framework;
using NUnit.Framework.Internal;

// This it outside of any namespace so it affects the whole assembly.
[SetUpFixture]
Expand Down
5 changes: 1 addition & 4 deletions Content.Tests/Content.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
<PropertyGroup>
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
<TargetFramework>$(TargetFramework)</TargetFramework>
Expand All @@ -11,7 +10,6 @@
<Platforms>AnyCPU</Platforms>
<Nullable>enable</Nullable>
</PropertyGroup>
<Import Project="..\RobustToolbox\MSBuild\Robust.DefineConstants.targets" />
<ItemGroup>
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.15.0" />
Expand Down Expand Up @@ -43,6 +41,5 @@
<Target Name="CopyDMStandardOnPublish" AfterTargets="Publish">
<Copy SourceFiles="@(DMStandard)" DestinationFiles="@(DMStandard->'$(PublishDir)\DMStandard\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>
<Import Project="..\RobustToolbox\MSBuild\Robust.Analyzers.targets" />

<Import Project="..\RobustToolbox\MSBuild\Robust.Properties.targets" />
</Project>
17 changes: 0 additions & 17 deletions Content.Tests/DMProject/Broken Tests/Stdlib/issaved.dm

This file was deleted.

45 changes: 45 additions & 0 deletions Content.Tests/DMProject/Tests/Builtins/json_decode.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

// Issue #1336
#define JSON(e) json_decode(json_encode(e))
#define TEST(v) ASSERT(JSON(v) == v)

// These two do not support nested lists at the moment
/proc/list_test(list/l)
var/n = length(l)
var/lj = JSON(l)
ASSERT(length(lj) == n)

if(!n) return
var/c = 0
for (var/i in 1 to n)
c += lj[i] == l[i]
ASSERT(c == n)

/proc/list_assoc_test(list/l)
var/n = length(l)
var/lj = JSON(l)
ASSERT(length(lj) == n)

if(!n) return
var/kc = 0
var/vc = 0
for (var/i in 1 to n)
kc += lj[i] == l[i]
vc += lj[lj[i]] == l[l[i]]
ASSERT(kc == n)
ASSERT(vc == n)

/proc/RunTest()
TEST(0.0)
TEST(5)
ASSERT(isnan(JSON(1.#IND)))
TEST(-1.#INF)
TEST(1.#INF)

list_test(list())
list_test(list(1))
list_test(list(1,2,3,4,5))

list_assoc_test(list("c" = 5))
list_assoc_test(list("a" = 1, "b" = 2))
list_assoc_test(list("a" = 1, "b" = 2, "c" = 5))
39 changes: 39 additions & 0 deletions Content.Tests/DMProject/Tests/Builtins/text2num.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// NaN != NaN in BYOND
#define isnan(x) ( (x) != (x) )

/proc/RunTest()
ASSERT(text2num(null) == null)
ASSERT(text2num("") == null)
ASSERT(text2num(".") == null)
ASSERT(text2num("-") == null)
ASSERT(text2num("+") == null)

ASSERT(text2num("12") == 12)
ASSERT(text2num("+12") == 12)
ASSERT(text2num("-12") == -12)
ASSERT(text2num("0") == 0)
ASSERT(text2num("1.0") == 1)
ASSERT(text2num("1.2344") == 1.2344)
ASSERT(text2num("0.0") == 0)
ASSERT(text2num(".4") == 0.4)

ASSERT(text2num("Z", 36) == 35)
ASSERT(text2num("A", 16) == 10)
ASSERT(text2num("z", 36) == 35)
ASSERT(text2num("a", 16) == 10)

ASSERT(text2num("F.A", 16) == 15.625)
ASSERT(text2num("f.a", 16) == 15.625)
ASSERT(text2num("F.A", 15) == null)
ASSERT(text2num("Z.0", 36) == 35)

ASSERT(text2num("F..A", 16) == 15)
ASSERT(text2num("4 2") == 4)

ASSERT(text2num("0xA") == 10)
ASSERT(text2num("0xA", 16) == 10)
ASSERT(text2num("0xA", 15) == 0)
ASSERT(text2num("0xA", 36) == 1198)

ASSERT(isnan(text2num("nan")))
ASSERT(isnan(text2num(" -nansomething")))
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/proc/RunTest()
var/resource = 'data/test.txt'
ASSERT(file2text(resource) == "Test resource file's content")

// Compile-time resources always use a forward slash
// file() does not
ASSERT("['data/test.txt']" == "data/test.txt")
ASSERT("['data\\test.txt']" == "data/test.txt")
ASSERT("[file("data/test.txt")]" == "data/test.txt")
ASSERT("[file("data\\test.txt")]" == "data\\test.txt") // Note the backslash here
56 changes: 56 additions & 0 deletions Content.Tests/DMProject/Tests/Expression/const_eval.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/datum
var/composite_expr = 4 * sin(3 + cos(2))
var/sintest = sin(45)
var/costest = cos(123)
var/tantest = tan(123)
var/sqrttest = sqrt(123)
var/arcsintest = arcsin(sin(45))
var/arccostest = arccos(cos(123))
var/arctantest = arctan(tan(69))
var/log_test = log(10)
var/log10_test = log(10, 100)
var/arctan2_test = arctan(1, 3)
var/abs_test = abs(-213)

#define EPSILON 4e-6
#define APX_EQUAL(a, b) ASSERT(abs(a - b) < EPSILON)

/proc/RunTest()
var/break_const_eval = null
var/datum/d = new /datum

APX_EQUAL(initial(d.composite_expr), 4 * sin(3 + cos(break_const_eval || 2)))
APX_EQUAL(d.composite_expr, 4 * sin(3 + cos(break_const_eval || 2)))

APX_EQUAL(d.sintest, sin(break_const_eval || 45))
APX_EQUAL(d.sintest, 0.707106769084930419921875)

APX_EQUAL(d.costest, cos(break_const_eval || 123))
APX_EQUAL(d.costest, -0.544639050960540771484375)

APX_EQUAL(d.tantest, tan(break_const_eval || 123))
APX_EQUAL(d.tantest, -1.539865016937255859375)

APX_EQUAL(d.sqrttest, sqrt(break_const_eval || 123))
APX_EQUAL(d.sqrttest, 11.0905361175537109375)

APX_EQUAL(d.arcsintest, arcsin(sin(break_const_eval || 45)))
APX_EQUAL(d.arcsintest, 45)

APX_EQUAL(d.arccostest, arccos(cos(break_const_eval || 123)))
APX_EQUAL(d.arccostest, 123)

APX_EQUAL(d.arctantest, arctan(tan(break_const_eval || 69)))
APX_EQUAL(d.arctantest, 69)

APX_EQUAL(d.log_test, log(break_const_eval || 10))
APX_EQUAL(d.log_test, 2.302585124969482421875)

APX_EQUAL(d.log10_test, log(break_const_eval || 10, 100))
APX_EQUAL(d.log10_test, 2)

APX_EQUAL(d.arctan2_test, arctan(break_const_eval || 1, 3))
APX_EQUAL(d.arctan2_test, 71.5650482177734375)

APX_EQUAL(d.abs_test, abs(break_const_eval || -213))

20 changes: 20 additions & 0 deletions Content.Tests/DMProject/Tests/List/ListFind.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/proc/RunTest()
var/list/L = list("a", "b", "c")

ASSERT(L.Find("b") == 2)

ASSERT(L.Find("b", 1) == 2)
ASSERT(L.Find("b", 2) == 2)
ASSERT(L.Find("b", 3) == 0)

ASSERT(L.Find("b", 1, 0) == 2)
ASSERT(L.Find("b", 2, 0) == 2)
ASSERT(L.Find("b", 3, 0) == 0)

ASSERT(L.Find("b", 1, 1) == 0)
ASSERT(L.Find("b", 1, 2) == 2)
ASSERT(L.Find("b", 1, 3) == 2)

ASSERT(L.Find("b", new /datum) == 2)
ASSERT(L.Find("b", "c") == 2)
ASSERT(L.Find("b", 1, new /datum) == 2)
3 changes: 0 additions & 3 deletions Content.Tests/DMProject/Tests/Math/Addition.dm

This file was deleted.

7 changes: 7 additions & 0 deletions Content.Tests/DMProject/Tests/Math/trig.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/proc/RunTest()
ASSERT(arctan(0) == 0)
ASSERT(arctan(1) == 45)
ASSERT(arctan(sqrt(3)) == 60)
ASSERT(round(arctan(3, 4)) == round(53.1301)) //that float precision tho
ASSERT(arctan(-1, 1) == 135)
ASSERT(arctan(0, -5) == -90)
Loading

0 comments on commit f4dc0de

Please sign in to comment.