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

utils: add arm32-specific NanoSleep implementation #3930

Merged
merged 1 commit into from
Apr 28, 2022

Conversation

algorandskiy
Copy link
Contributor

Summary

arm32 has int32 field members in Timespec struct, but Nanoseconds() returns int64.
The arm32-specific implementation of NanoSleep casts it to int32 as Timespec expects.

Test Plan

Existing tests

@algorandskiy algorandskiy self-assigned this Apr 27, 2022
@algorandskiy algorandskiy changed the title Add arm32-specific NanoSleep implementation utils: add arm32-specific NanoSleep implementation Apr 27, 2022
@@ -14,6 +14,9 @@
// You should have received a copy of the GNU Affero General Public License
// along with go-algorand. If not, see <https://www.gnu.org/licenses/>.

//go:build !arm && linux
// +build !arm,linux
Copy link
Contributor

@cce cce Apr 27, 2022

Choose a reason for hiding this comment

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

the _linux filename provides its own build tag constraints based on whether GOOS=linux ... I'm not sure if you can mix file suffixes with build tags? or maybe you can?
https://dave.cheney.net/2013/10/12/how-to-use-conditional-compilation-with-the-go-build-tool

if not maybe change the name of this file to not end with _linux (but otherwise keep the rest the same)

Copy link
Contributor

@cce cce Apr 27, 2022

Choose a reason for hiding this comment

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

oh found this: https://pkg.go.dev/cmd/go#hdr-Build_constraints

If a file's name, after stripping the extension and a possible _test suffix, matches any of the following patterns:
*_GOOS
*_GOARCH
*_GOOS_GOARCH
(example: source_windows_amd64.go) where GOOS and GOARCH represent any known operating system and architecture values respectively, then the file is considered to have an implicit build constraint requiring those terms (in addition to any explicit constraints in the file).

^^ "in addition to any explicit constraints in the file" so I guess that is OK (though you are getting the linux constraint for free from the filename)

// along with go-algorand. If not, see <https://www.gnu.org/licenses/>.

//go:build arm && linux
// +build arm,linux
Copy link
Contributor

Choose a reason for hiding this comment

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

might as well throw 386 in too as well as arm?

util/sleep_linux_arm.go Outdated Show resolved Hide resolved
// along with go-algorand. If not, see <https://www.gnu.org/licenses/>.

//go:build linux
// +build linux
Copy link
Contributor

Choose a reason for hiding this comment

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

very tiny nit, but wouldn't this file be better named sleep_linux.go and then have the other two be called sleep_linux_32.go and sleep_linux_64.go or something

Copy link
Contributor Author

Choose a reason for hiding this comment

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

make sense, added 386 as well

cce
cce previously approved these changes Apr 27, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2022

Codecov Report

Merging #3930 (3c12c4c) into master (a653a76) will increase coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3930      +/-   ##
==========================================
+ Coverage   49.95%   49.98%   +0.03%     
==========================================
  Files         400      400              
  Lines       68651    68651              
==========================================
+ Hits        34295    34316      +21     
+ Misses      30649    30628      -21     
  Partials     3707     3707              
Impacted Files Coverage Δ
network/wsPeer.go 65.83% <0.00%> (-3.06%) ⬇️
catchup/service.go 68.64% <0.00%> (-0.75%) ⬇️
network/wsNetwork.go 62.99% <0.00%> (ø)
ledger/acctupdates.go 69.16% <0.00%> (+0.65%) ⬆️
cmd/tealdbg/debugger.go 73.49% <0.00%> (+0.80%) ⬆️
data/transactions/verify/txn.go 45.02% <0.00%> (+0.86%) ⬆️
data/abi/abi_type.go 88.62% <0.00%> (+0.94%) ⬆️
catchup/peerSelector.go 100.00% <0.00%> (+1.04%) ⬆️
node/node.go 25.03% <0.00%> (+1.84%) ⬆️
ledger/tracker.go 76.62% <0.00%> (+2.16%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a653a76...3c12c4c. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants