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

[compiler] More tests for "for" loops #11584

Merged
merged 4 commits into from
Jan 18, 2024
Merged

[compiler] More tests for "for" loops #11584

merged 4 commits into from
Jan 18, 2024

Conversation

brmataptos
Copy link
Contributor

Description

Add a few more tests for for loops. Copy some tests over to move-compiler-v2 to also test there.
For correct code, use transactional-tests, but for compiler errors, use tests.

Also fix a typo in one test making it not useful.

Addresses Issue #11583.

Test Plan

These are tests.

Copy link

trunk-io bot commented Jan 6, 2024

⏱️ 8h 18m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-unit-tests 2h 42m 🟩🟩🟩🟩 (+1 more)
windows-build 1h 49m 🟩🟩🟩🟩🟩 (+1 more)
rust-move-unit-coverage 1h 41m 🟩🟩🟥🟩 (+1 more)
rust-lints 44m 🟩🟩🟩🟩🟩 (+1 more)
run-tests-main-branch 25m 🟩🟩🟩🟩🟩 (+1 more)
check 24m 🟩🟩🟩🟩🟩 (+1 more)
general-lints 16m 🟩🟩🟩🟩🟩 (+1 more)
check-dynamic-deps 13m 🟩🟩🟩🟩🟩 (+1 more)
semgrep/ci 2m 🟩🟩🟩🟩🟩 (+1 more)
file_change_determinator 1m 🟩🟩🟩🟩🟩 (+1 more)
file_change_determinator 1m 🟩🟩🟩🟩🟩 (+1 more)
permission-check 17s 🟩🟩🟩🟩🟩 (+1 more)
permission-check 16s 🟩🟩🟩🟩🟩 (+1 more)
permission-check 16s 🟩🟩🟩🟩🟩 (+1 more)
permission-check 15s 🟩🟩🟩🟩🟩 (+1 more)

🚨 1 job on the last run was significantly faster/slower than expected

Job Duration vs 7d avg Delta
windows-build 11m 18m -39%

settingsfeedbackdocs ⋅ learn more about trunk.io

@brmataptos brmataptos requested review from aalok-t and vineethk January 6, 2024 00:53
Copy link

codecov bot commented Jan 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (409779a) 68.8% compared to head (a3418de) 68.9%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##             main   #11584     +/-   ##
=========================================
+ Coverage    68.8%    68.9%   +0.1%     
=========================================
  Files         775      775             
  Lines      178229   178229             
=========================================
+ Hits       122677   122866    +189     
+ Misses      55552    55363    -189     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@vineethk vineethk left a comment

Choose a reason for hiding this comment

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

Have some minor comments, LGTM otherwise.

Thanks for doing this!

continue
}
assert!(move x == 5, 42);
for (i in 0..10) { // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for (i in 0..10) { // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
for (i in 0..10) { // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Copy link
Contributor

Choose a reason for hiding this comment

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

Upper bound is exclusive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fxied.

for (i in 0..10) { // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
x = x + 1; // 1, 4, 13, 16,
if (x >= 15) break;
x = x + 2; // 3, 6, 15, -
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
x = x + 2; // 3, 6, 15, -
x = x + 2; // 3, 6, 15, -

Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation here and below (assignments to x) should be fixed for readability.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, emacs added tabs. gotta get rid of that.

@@ -0,0 +1,151 @@
processed 1 task

task 0 'print-bytecode'. lines 1-25:
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this *.exp1 file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, was a backup file.

fun main() {
let k = 0;
let y = 0;
for (j in 0..10) { //j: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Copy link
Contributor

Choose a reason for hiding this comment

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

The indentation in this test is broken: makes it hard to read.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

again, tab issue.

@@ -0,0 +1,18 @@
//# publish
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like many non-for-loop related tests (like this one) were also added. I am assuming this is intentional.

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 was making /control_flow/ the same for V1 and V2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I've also backpedaled and removed a test that doesn't yield expected warnings on -v2 now.

address 0x42 {
module M {

// fun t1() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Weird to have commented out code here. Any particular reason?

script {
fun main() {
let x = 0;
for (i in 0..10) { // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar comments as made on the "original" file.

y = y + 2; //y: 3, 6, 15, -
let x = 0;
for (i in 0..10) { //i: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
x = x + 1; //x: 1, 4, 13, 16,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix indentation if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, tabs again.

@brmataptos brmataptos requested a review from wrwg January 9, 2024 19:27
@brmataptos brmataptos removed the request for review from aalok-t January 16, 2024 18:28
@brmataptos brmataptos changed the title More tests for "for" loops [compiler] More tests for "for" loops Jan 16, 2024
@brmataptos brmataptos enabled auto-merge (squash) January 18, 2024 07:18

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

✅ Forge suite compat success on aptos-node-v1.8.3 ==> a3418de924c811edd3703d2f8ab8f0e215fdc7c3

Compatibility test results for aptos-node-v1.8.3 ==> a3418de924c811edd3703d2f8ab8f0e215fdc7c3 (PR)
1. Check liveness of validators at old version: aptos-node-v1.8.3
compatibility::simple-validator-upgrade::liveness-check : committed: 3248 txn/s, latency: 6743 ms, (p50: 6900 ms, p90: 9600 ms, p99: 14500 ms), latency samples: 178640
2. Upgrading first Validator to new version: a3418de924c811edd3703d2f8ab8f0e215fdc7c3
compatibility::simple-validator-upgrade::single-validator-upgrade : committed: 1775 txn/s, latency: 16326 ms, (p50: 19200 ms, p90: 22300 ms, p99: 22600 ms), latency samples: 92340
3. Upgrading rest of first batch to new version: a3418de924c811edd3703d2f8ab8f0e215fdc7c3
compatibility::simple-validator-upgrade::half-validator-upgrade : committed: 1788 txn/s, latency: 16292 ms, (p50: 18700 ms, p90: 22200 ms, p99: 22400 ms), latency samples: 93000
4. upgrading second batch to new version: a3418de924c811edd3703d2f8ab8f0e215fdc7c3
compatibility::simple-validator-upgrade::rest-validator-upgrade : committed: 3606 txn/s, latency: 8762 ms, (p50: 9900 ms, p90: 12400 ms, p99: 12700 ms), latency samples: 144260
5. check swarm health
Compatibility test for aptos-node-v1.8.3 ==> a3418de924c811edd3703d2f8ab8f0e215fdc7c3 passed
Test Ok

Copy link
Contributor

✅ Forge suite realistic_env_max_load success on a3418de924c811edd3703d2f8ab8f0e215fdc7c3

two traffics test: inner traffic : committed: 7182 txn/s, latency: 5327 ms, (p50: 4800 ms, p90: 6800 ms, p99: 14400 ms), latency samples: 3110020
two traffics test : committed: 100 txn/s, latency: 2324 ms, (p50: 2200 ms, p90: 2600 ms, p99: 8300 ms), latency samples: 1860
Latency breakdown for phase 0: ["QsBatchToPos: max: 0.258, avg: 0.209", "QsPosToProposal: max: 0.150, avg: 0.142", "ConsensusProposalToOrdered: max: 0.596, avg: 0.546", "ConsensusOrderedToCommit: max: 0.491, avg: 0.465", "ConsensusProposalToCommit: max: 1.058, avg: 1.010"]
Max round gap was 1 [limit 4] at version 1511389. Max no progress secs was 9.330177 [limit 10] at version 1511389.
Test Ok

@brmataptos brmataptos merged commit 8f0c41a into main Jan 18, 2024
81 of 85 checks passed
@brmataptos brmataptos deleted the brm-issue-11583 branch January 18, 2024 07:47
Copy link
Contributor

❌ Forge suite framework_upgrade failure on aptos-node-v1.8.3 ==> a3418de924c811edd3703d2f8ab8f0e215fdc7c3

Compatibility test results for aptos-node-v1.8.3 ==> a3418de924c811edd3703d2f8ab8f0e215fdc7c3 (PR)
Upgrade the nodes to version: a3418de924c811edd3703d2f8ab8f0e215fdc7c3
Test Failed: API error: Unknown error error sending request for url (http://aptos-node-3-validator.forge-framework-upgrade-pr-11584.svc:8080/v1/accounts/0000000000000000000000000000000000000000000000000000000000000001/resource/0x1::block::BlockResource): error trying to connect: dns error: failed to lookup address information: Name or service not known

Stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: __libc_start_main
  15: <unknown>
Trailing Log Lines:
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: __libc_start_main
  15: <unknown>


Swarm logs can be found here: See fgi output for more information.
thread 'main' panicked at testsuite/forge/src/backend/k8s/swarm.rs:676:18:
called `Result::unwrap()` on an `Err` value: ApiError: namespaces "forge-framework-upgrade-pr-11584" not found: NotFound (ErrorResponse { status: "Failure", message: "namespaces \"forge-framework-upgrade-pr-11584\" not found", reason: "NotFound", code: 404 })

Caused by:
    namespaces "forge-framework-upgrade-pr-11584" not found: NotFound

Stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: __libc_start_main
  16: <unknown>
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Debugging output:

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.

3 participants