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

Support Rust files in wat2wasm4cpp.py script #704

Merged
merged 3 commits into from
Feb 1, 2021
Merged

Support Rust files in wat2wasm4cpp.py script #704

merged 3 commits into from
Feb 1, 2021

Conversation

gumb0
Copy link
Collaborator

@gumb0 gumb0 commented Jan 28, 2021

Closes #593.

I used rustfmt becaust it takes a single file as argument.
However, it doesn't seem much useful, e.g. long hex strings are not broken down (this option is unstable and off by default
https://rust-lang.github.io/rustfmt/?version=v1.4.33&search=#format_strings
rust-lang/rustfmt#3353)

@gumb0 gumb0 changed the base branch from master to doxygen-ci-fix January 28, 2021 17:46
@gumb0 gumb0 marked this pull request as draft January 28, 2021 17:49
@gumb0 gumb0 force-pushed the wat2wasm4rs branch 2 times, most recently from 14f80bc to e547964 Compare January 28, 2021 17:57
@codecov
Copy link

codecov bot commented Jan 28, 2021

Codecov Report

Merging #704 (c77f160) into master (51457e8) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #704   +/-   ##
=======================================
  Coverage   99.27%   99.27%           
=======================================
  Files          73       73           
  Lines       10883    10883           
=======================================
  Hits        10804    10804           
  Misses         79       79           
Flag Coverage Δ
rust 97.64% <ø> (ø)
spectests 90.84% <ø> (ø)
unittests 99.31% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@axic
Copy link
Member

axic commented Jan 28, 2021

However, it doesn't seem much useful, e.g. long hex strings are not broken down

Yes that is a bit annoying, but still better to have this automated.

Base automatically changed from doxygen-ci-fix to master January 29, 2021 11:22
./wat2wasm4tests.py test/unittests/validation_test.cpp
./wat2wasm4tests.py test/unittests/wasm_engine_test.cpp
./wat2wasm4tests.py test/spectests/spectests.cpp
./wat2wasm4tests.py test/testfloat/testfloat.cpp
git diff --color --exit-code
Copy link
Member

Choose a reason for hiding this comment

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

Should also add bindings/rust/src/lib.rs to the CI.

@gumb0 gumb0 marked this pull request as ready for review January 29, 2021 14:04
@@ -31,10 +31,16 @@
WAT2WASM_TOOL = 'wat2wasm'
WAT2WASM_DEFAULT_OPTIONS = ['--disable-saturating-float-to-int',
'--disable-sign-extension', '--disable-multi-value']
FORMAT_TOOL = 'clang-format'
CPP_FORMAT_TOOL = ['clang-format', '-i']
RS_FORMAT_TOOL = ['rustfmt']
Copy link
Member

Choose a reason for hiding this comment

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

Did you try this on ci? Doesn't it need to be installed on the run?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually it would ignore failures if rustfmt were not found, let me check it then.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You were right, it didn't work. I fixed it by moving into bindings-rust job, where it's already installed (but then wabt needs to be installed there, too)

@gumb0 gumb0 requested review from chfast and axic January 29, 2021 14:11
@gumb0 gumb0 force-pushed the wat2wasm4rs branch 4 times, most recently from 30711b7 to d7530f0 Compare January 29, 2021 14:53
@gumb0 gumb0 marked this pull request as draft January 29, 2021 15:02
@gumb0 gumb0 force-pushed the wat2wasm4rs branch 5 times, most recently from dbe4034 to 0f4dc74 Compare January 29, 2021 17:31
@gumb0 gumb0 marked this pull request as ready for review January 29, 2021 17:31
@@ -35,7 +35,7 @@ commands:
else
[[ $OSTYPE = darwin* ]] && os=macos || os=ubuntu
cd /usr/local
curl -L https://github.com/WebAssembly/wabt/releases/download/1.0.20/wabt-1.0.20-$os.tar.gz | sudo tar xz --strip 1
curl -L https://github.com/WebAssembly/wabt/releases/download/1.0.20/wabt-1.0.20-$os.tar.gz | (sudo tar xz --strip 1 || tar xz --strip 1)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This solves the problem of sudo not working in Rust docker (user is already root there), probably there are more elegant ways to solve it, but this works.

Copy link
Member

Choose a reason for hiding this comment

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

@gumb0 @chfast Since #706 also runs into this problem with sudo pip3, how about we just install sudo on the rust tasks and leave these helpers intact?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It might be better to migrate to cimg/rust where build are probably not executed as root and there may be more CI related benefits.

circle.yml Outdated Show resolved Hide resolved
circle.yml Outdated Show resolved Hide resolved
circle.yml Outdated
name: Check wat2wasm4tests
command: |
rustfmt --version
./wat2wasm4tests.py bindings/rust/src/lib.rs
Copy link
Member

Choose a reason for hiding this comment

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

Why not use find here too (like for C++)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That would be good to.

@gumb0 gumb0 merged commit 159d355 into master Feb 1, 2021
@gumb0 gumb0 deleted the wat2wasm4rs branch February 1, 2021 16:47
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.

Extend wast2wasm4cpp to also work with Rust sources
3 participants