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

ci: build and test tntcxx on macos 11 and 12 #55

Merged
merged 5 commits into from
Oct 26, 2023

Conversation

drewdzzz
Copy link
Collaborator

@drewdzzz drewdzzz commented Oct 16, 2023

The project is tested in both Release and Debug modes on each version of
macos. Tarantool is installed from brew, the last stable version is used.

@drewdzzz drewdzzz self-assigned this Oct 16, 2023
@drewdzzz drewdzzz force-pushed the macos-ci branch 3 times, most recently from 843390f to 1cd2be4 Compare October 16, 2023 16:39
@drewdzzz drewdzzz changed the title ci: add macos 11 ci: add macos Oct 16, 2023
@drewdzzz drewdzzz force-pushed the macos-ci branch 16 times, most recently from 62c3658 to 9a4859e Compare October 19, 2023 01:43
@drewdzzz drewdzzz changed the title ci: add macos ci: build and test tntcxx on macos 11 and 12 Oct 19, 2023
@drewdzzz drewdzzz requested a review from alyapunov October 19, 2023 01:49
@drewdzzz drewdzzz assigned alyapunov and unassigned drewdzzz Oct 19, 2023
.github/workflows/osx.yml Outdated Show resolved Hide resolved
* will kill its child process, which is Tarantool, and exit.
* In the case, when the intermediate process fails to fork Tarantool, it kills
* the parent process and terminates.
*/
Copy link
Member

@CuriousGeorgiy CuriousGeorgiy Oct 23, 2023

Choose a reason for hiding this comment

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

I agree with @alyapunov in the sense that this is code is really sophistacted, but I guess there is no other way to implement this approach on macOS, so I see two ways to make life easier for us:

  1. Since the approach @drewdzzz proposes here is portable, let's use it everywhere: i.e., drop the Linux version and only leave this one.
  2. Abandon this approach entirely, and instead refactor our test code to save the Tarantool PID (perhaps, create some TarantoolInstance object), and clean it up properly when testing fails. An approach like this is used in go-tarantool, for instance 1. Not sure what to do, if the test crashes though (seems like the process leaks in this case), I guess we should consult with someone from @tarantool/ecosystem, like @DifferentialOrange or @0x501D.

Footnotes

  1. https://github.com/tarantool/go-tarantool/blob/bd6aab9db09260abe3bfe929b23e81a0171abf2b/shutdown_test.go#L137-L139

Copy link
Member

Choose a reason for hiding this comment

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

Not sure what to do, if the test crashes though

go-tarantool is also unable to shutdown Tarantool processes in case of a crash now, so this problem is unresolved for us as well.

Choose a reason for hiding this comment

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

Not sure what to do, if the test crashes though

go-tarantool is also unable to shutdown Tarantool processes in case of a crash now, so this problem is unresolved for us as well.

This is an implementation flaw. It could be implemented in Go for panic in fact:
tarantool/go-tarantool#147 (comment)

But there is no solution to the problem in go-tarantool that would be suitable for C++.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why do you think that a process leak happens?
I crashed the test and all processes have been deleted.

Copy link
Member

@CuriousGeorgiy CuriousGeorgiy Oct 24, 2023

Choose a reason for hiding this comment

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

Why do you think that a process leak happens?

I mean if we go for option 2 that I listed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In this case, kill is signal-safe, so we could kill Tarantool from signal handler.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I also thought about this, we could add signal handlers from recoverable signals (i.e., even go can't do anything about SIGKILL).

Another path we can take is setting up and cleaning up Tarantool externally (i.e., via the test harness or some shell scripting), but it may not be scalable or convenient.

Copy link
Member

Choose a reason for hiding this comment

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

I guess it's time for @alyapunov to take the decision how we should proceed here.

@drewdzzz drewdzzz force-pushed the macos-ci branch 4 times, most recently from 15f8961 to 66eea01 Compare October 24, 2023 16:35
@drewdzzz drewdzzz added the blocked Not ready to be implemented label Oct 24, 2023
@drewdzzz drewdzzz force-pushed the macos-ci branch 4 times, most recently from f62deb7 to a25175c Compare October 24, 2023 17:39
make -j

- name: test without SSL
if: matrix.test-ssl == 'Disabled'
run: cd build && ctest --output-on-failure -E ClientSSL.test
Copy link
Member

@CuriousGeorgiy CuriousGeorgiy Oct 25, 2023

Choose a reason for hiding this comment

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

[feel free to ignore, just for your knowledge]

Nit: you could use the ${{ matrix.test-ssl == 'Disabled' && 'ClientSSL.test' || ''}} ternary operator syntax (see example here) just like in Lua to simplify the code and have less branches.

@drewdzzz drewdzzz removed the blocked Not ready to be implemented label Oct 26, 2023
The test uses std::vector, but it was not included by mistake.
The file uses std::size, std::begin and other such methods, but header
with definitions was not included by mistake.
Function launchTarantool creates a process, which is killed when the
parent process is dead. Since it uses prctl, it works only on Linux -
on other platforms Tarantool is not killed and ctest hangs. Let's
add POSIX-compatible implementation of launchTarantool for non-Linux
platforms.
The project is tested in both Release and Debug modes on each version of
macos. Tarantool is installed from brew, the last stable version is used.
The workflow is defined in the same file as Ubuntu workflow, so the file
is renamed to "testing".
We are unable to test SSL conection without tarantool-ee, but we still
can build tarantool with SSL and skip ClientSSL test. Let's do so.
@alyapunov alyapunov merged commit c6dbf3c into tarantool:master Oct 26, 2023
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.

5 participants