Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC] Add native tests #201

Merged
merged 25 commits into from
Jul 20, 2021
Merged

Conversation

RassK
Copy link
Contributor

@RassK RassK commented Jul 9, 2021

Adds native tests & CI support (GH Actions). Building via Nuke.

What's next:

  • Seems Linux / MacOS unit tests have been missing all time. We should look into adding these.
  • Remove workflow.yml when managed layer is covered.
  • Create target to ensure all autogenerated parts are committed to git (by running git diff --exit-code target)
  • Investigate OTEL_TRACE_LOG_DIRECTORY defaults and hardcoded parts.
  • Native lib output has still DD naming in Linux / MacOS. Correct in Windows.
  • Recheck .gitignore for Linux / MacOS

@@ -9,6 +9,8 @@ class CLRHelperTest : public ::CLRHelperTestBase {};

TEST_F(CLRHelperTest, EnumeratesTypeDefs) {
std::vector<std::wstring> expected_types = {
L"Microsoft.CodeAnalysis.EmbeddedAttribute",
Copy link
Contributor Author

@RassK RassK Jul 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pjanotti Any idea what required these additional attributes? At first I thought it's GlobalSuppressions.cs, but then the solution already references linked solution level GlobalSuppressions. + Something turned on code analysis for dependency samples that wasn't required in previous commit.

CC - @pellared @dszmigielski

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the namespace this is an attribute type added by Roslyn, but I don't know its purpose. Can you point me to the commit in which wasn't required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was the first commit (7bce5a0) then nuke was added (d8b7e40) and additional attributes appeared.

Copy link
Contributor

@pjanotti pjanotti Jul 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RassK from a quick check that attribute is added to netstandard1.0 and netstandard2.0 assemblies - I'm not sure but perhaps this was not added with some older version of Roslyn. Another possibility is that they were always there but the test didn't error when they were not listed (although the macro seems to imply equality).

Copy link
Contributor

@dszmigielski dszmigielski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot of code, but I would love to have it merged ASAP. There is so much overlap on my task with what you have already done in terms of nuke setup, that doing that once again is just waste of time. If something is missing/wrong we can work on improving that along the way, but at least all of us would work on the same base.

@RassK RassK marked this pull request as ready for review July 13, 2021 12:48
@RassK RassK requested a review from a team July 13, 2021 12:48
@RassK RassK changed the title [WIP|POC] Add native tests [POC] Add native tests Jul 13, 2021
@RassK RassK requested a review from dszmigielski July 13, 2021 12:51
Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed code related to Nuke.
I still need to review everything under test path

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@@ -0,0 +1,62 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rewritte this logic to Nuke?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, that's the second Todo after managed layer is nuked.

Datadog.Trace.Native.sln Outdated Show resolved Hide resolved
build/nuke/Build.Steps.Linux.cs Show resolved Hide resolved
build/nuke/Extensions/DotNetSettingsExtensions.cs Outdated Show resolved Hide resolved
build/nuke/Build.Steps.Linux.cs Show resolved Hide resolved
build/nuke/Build.Steps.cs Show resolved Hide resolved
build/nuke/Build.Steps.cs Show resolved Hide resolved
build/nuke/Build.cs Outdated Show resolved Hide resolved
@@ -0,0 +1,44 @@
# ------------------------------------------------------------------------------
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to add a target with executes git diff --exit-code to ensure that someone has not forgotten to commit the autogenerated code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great idea, I think it can be a task of it's own. Will add to todo.

To build using specific target run:

```cmd
dotnet nuke --target TargetNameHere
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS. dotnet nuke TargetNameHere works as well and this is what I use from commandline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about changing cmd line to:
dotnet nuke [--target] TargetNameHere

Wondering if it's understandable?

Copy link
Member

@pellared pellared Jul 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 For me the output of dotnet nuke help is enough and I do not need this fragment 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is "TargetNameHere" I think that the optional parameter doesn't add value.

docs/DEVELOPING.md Show resolved Hide resolved
@@ -0,0 +1,7 @@
:; set -eo pipefail
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines seem like a left-over.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is some kind of hack to make .cmd work on Linux and MacOS. I do not know how it works... But I think it does 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic 😮 - I needed to chmod it to try it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On MacOS it also builds a bunch of files that are not ignored. @RassK could check if the .gitignore needs some updates?

@@ -9,6 +9,8 @@ class CLRHelperTest : public ::CLRHelperTestBase {};

TEST_F(CLRHelperTest, EnumeratesTypeDefs) {
std::vector<std::wstring> expected_types = {
L"Microsoft.CodeAnalysis.EmbeddedAttribute",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the namespace this is an attribute type added by Roslyn, but I don't know its purpose. Can you point me to the commit in which wasn't required?

@pellared
Copy link
Member

Moreover, I remember that @pjanotti was asking to reorganize in a way to have the productions code, test code, and sample code closer to each other.

Any thoughts about this?

Copy link
Member

@pellared pellared left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR is a state that is worth merging.

Copy link
Contributor

@pjanotti pjanotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pjanotti pjanotti merged commit 6965788 into open-telemetry:poc-otel-sdk Jul 20, 2021
@pjanotti
Copy link
Contributor

Moreover, I remember that @pjanotti was asking to reorganize in a way to have the productions code, test code, and sample code closer to each other.

Any thoughts about this?

@RassK @pellared we really should look into that but more related to instrumentations (there are some challenges but it should be possible).

@RassK RassK deleted the native-tests branch September 15, 2021 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants