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

tests: Add Rust basic testcase #1839

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

paranlee
Copy link
Contributor

Add Rust-lang abc test for rust supports.

uftrace/tests $ ./runtest.py -vdp -R 001
info: using existing install for 'nightly-aarch64-unknown-linux-gnu'
info: default toolchain set to 'nightly-aarch64-unknown-linux-gnu'
Start 1 tests without worker pool

Compiler                  rustc
Runtime test case         pg
------------------------:
build command: rustc +nightly -Z instrument-mcount s-abc.rs
test command: /home/kim/uftrace/uftrace live --no-pager --no-event --libmcount-path=/home/kim/uftrace   -N memcpy /home/kim/uftrace/tests/s-abc
=========== original ===========
# DURATION     TID     FUNCTION
   3.778 us [1008725] | getauxval();
   0.241 us [1008725] | getauxval();
   0.241 us [1008725] | getauxval();
            [1008725] | std::rt::lang_start() {
  13.685 us [1008725] |   poll();
   4.908 us [1008725] |   signal();
   2.981 us [1008725] |   sigaction();
   2.519 us [1008725] |   sigaction();
   2.518 us [1008725] |   sigaction();
   3.056 us [1008725] |   sigaltstack();
   1.056 us [1008725] |   sysconf();
  14.296 us [1008725] |   mmap64();
   0.297 us [1008725] |   sysconf();
  24.259 us [1008725] |   mprotect();
   0.352 us [1008725] |   sysconf();
   2.185 us [1008725] |   sigaltstack();
   0.241 us [1008725] |   sysconf();
   0.333 us [1008725] |   pthread_self();
 617.868 us [1008725] |   pthread_getattr_np();
   2.074 us [1008725] |   pthread_attr_getstack();
   0.482 us [1008725] |   pthread_attr_destroy();
   0.260 us [1008725] |   malloc();
   0.519 us [1008725] |   malloc();
   5.537 us [1008725] |   __cxa_thread_atexit_impl();
            [1008725] |   std::rt::lang_start::_{{closure}}() {
            [1008725] |     std::sys_common::backtrace::__rust_begin_short_backtrace() {
            [1008725] |       core::ops::function::FnOnce::call_once() {
            [1008725] |         s_abc::main() {
            [1008725] |           s_abc::a() {
            [1008725] |             s_abc::b() {
            [1008725] |               s_abc::c() {
   3.037 us [1008725] |                 getpid();
   5.370 us [1008725] |               } /* s_abc::c */
   6.241 us [1008725] |             } /* s_abc::b */
   6.814 us [1008725] |           } /* s_abc::a */
   7.482 us [1008725] |         } /* s_abc::main */
   8.426 us [1008725] |       } /* core::ops::function::FnOnce::call_once */
   9.222 us [1008725] |     } /* std::sys_common::backtrace::__rust_begin_short_backtrace */
   0.167 us [1008725] |     _<()>::report();
  10.833 us [1008725] |   } /* std::rt::lang_start::_{{closure}} */
   2.259 us [1008725] |   sigaltstack();
   0.278 us [1008725] |   sysconf();
   0.185 us [1008725] |   sysconf();
  42.259 us [1008725] |   munmap();
 796.552 us [1008725] | } /* std::rt::lang_start */
   0.648 us [1008725] | free();
   0.204 us [1008725] | free();

===========  result  ===========
 getauxval();
 getauxval();
 getauxval();
 std::rt::lang_start() {
   poll();
   signal();
   sigaction();
   sigaction();
   sigaction();
   sigaltstack();
   sysconf();
   mmap64();
   sysconf();
   mprotect();
   sysconf();
   sigaltstack();
   sysconf();
   pthread_self();
   pthread_getattr_np();
   pthread_attr_getstack();
   pthread_attr_destroy();
   malloc();
   malloc();
   __cxa_thread_atexit_impl();
   std::rt::lang_start::_{{closure}}() {
     std::sys_common::backtrace::__rust_begin_short_backtrace() {
       core::ops::function::FnOnce::call_once() {
         s_abc::main() {
           s_abc::a() {
             s_abc::b() {
               s_abc::c() {
                 getpid();
               } /* s_abc::c */
             } /* s_abc::b */
           } /* s_abc::a */
         } /* s_abc::main */
       } /* core::ops::function::FnOnce::call_once */
     } /* std::sys_common::backtrace::__rust_begin_short_backtrace */
     _<()>::report();
   } /* std::rt::lang_start::_{{closure}} */
   sigaltstack();
   sysconf();
   sysconf();
   munmap();
 } /* std::rt::lang_start */
 free();
 free();
=========== expected ===========
 getauxval();
 getauxval();
 getauxval();
 std::rt::lang_start() {
   poll();
   signal();
   sigaction();
   sigaction();
   sigaction();
   sigaltstack();
   sysconf();
   mmap64();
   sysconf();
   mprotect();
   sysconf();
   sigaltstack();
   sysconf();
   pthread_self();
   pthread_getattr_np();
   pthread_attr_getstack();
   pthread_attr_destroy();
   malloc();
   malloc();
   __cxa_thread_atexit_impl();
   std::rt::lang_start::_{{closure}}() {
     std::sys_common::backtrace::__rust_begin_short_backtrace() {
       core::ops::function::FnOnce::call_once() {
         s_abc::main() {
           s_abc::a() {
             s_abc::b() {
               s_abc::c() {
                 getpid();
               } /* s_abc::c */
             } /* s_abc::b */
           } /* s_abc::a */
         } /* s_abc::main */
       } /* core::ops::function::FnOnce::call_once */
     } /* std::sys_common::backtrace::__rust_begin_short_backtrace */
     _<()>::report();
   } /* std::rt::lang_start::_{{closure}} */
   sigaltstack();
   sysconf();
   sysconf();
   munmap();
 } /* std::rt::lang_start */
 free();
 free();
001 basic               : OK

Signed-off-by: Michelle Jin [email protected]
Co-authored-by: Paran Lee [email protected]

@paranlee
Copy link
Contributor Author

@MichelleJin12 I updated some codes. :) Thanks for your first drafts.

tests/runtest.py Outdated
@@ -1000,6 +1068,7 @@ def parse_argument():
patch_size = {
'x86_64' : 5,
'aarch64' : 2,
'riscv' : 2,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gichoel I think same with aarch64. We need to double checking.

Copy link
Contributor

Choose a reason for hiding this comment

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

As you may already know, the RISC-V architecture does not yet support dynamic tracing. Therefore, related code must be added after introducing Dynamic Tracing in the RISC-V architecture.

For the above reasons and to reduce confusion, I think you should remove riscv from the patch_size variable in that code, so that the string fpatchable-function-entry not support on current platform is printed and the program exits.

Additionally, although I'm not sure yet, there is a commit that forces RISC-V kernels to use -fpatchable-function-entry=8, so you should check if you can use the same value as aarch64.
ref. https://git.kernel.org/torvalds/c/afc76b8b8011

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review. I will include both @MichelleJin12 @gichoel feedback. :)

@@ -1029,6 +1098,9 @@ def has_compiler(compiler):
compilers = []
if arg.python:
compilers.append('python')
elif arg.rust:
if has_compiler('rustc') and os.system('rustup default nightly > /dev/null') == 0:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are there nice nightly checking? This because Rust compiler flags +nightly -Z instrument-mcount needed. :)

618.405 us [1008471] | pthread_getattr_np();
0.389 us [1008471] | pthread_attr_getstack();
0.371 us [1008471] | pthread_attr_destroy();
0.166 us [1008471] | malloc();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is some point of non-deterministic behavior occurred.

@MichelleJin12
Copy link
Contributor

How about splitting it into a commit for risc-v and a commit for rust test?

@paranlee
Copy link
Contributor Author

@MichelleJin12 I thought a lot about whether to include that code or not, so I added it, but it makes sense.
The RISC-V related 2 part looks good enough to be used in other tasks in the future.

@MichelleJin12
Copy link
Contributor

MichelleJin12 commented Oct 29, 2023

  1. There is a bug where an error occurs if the s-abc executable file is not already created. You should run the build command once to create s-abc.
$ ./runtest.py -vdp -R 001
info: using existing install for 'nightly-x86_64-unknown-linux-gnu'
info: default toolchain set to 'nightly-x86_64-unknown-linux-gnu'
Start 1 tests without worker pool

Compiler                  rustc
Runtime test case         pg
------------------------:
build command: rustc +nightly -Z instrument-mcount s-abc.rs
test command: /home/vagrant/uftrace_nh/uftrace live --no-pager --no-event --libmcount-path=/home/vagrant/uftrace_nh   -N memcpy /home/vagrant/uftrace_nh/tests/s-abc
uftrace: /home/vagrant/uftrace_nh/cmds/record.c:1564:find_in_path
 ERROR: Cannot trace '/home/vagrant/uftrace_nh/tests/s-abc': No such executable file.
r001_basic:  returns 1

001 basic               : NZ
  1. The -C passes='ee-instrument<post-inline>' option should be added to the build command to avoid the error below.
$ rustc +nightly -Z instrument-mcount s-abc.rs
$ ./runtest.py -vdp -R 001
info: using existing install for 'nightly-x86_64-unknown-linux-gnu'
info: default toolchain set to 'nightly-x86_64-unknown-linux-gnu'
Start 1 tests without worker pool

Compiler                  rustc
Runtime test case         pg
------------------------:
build command: rustc +nightly -Z instrument-mcount s-abc.rs
test command: /home/vagrant/uftrace_nh/uftrace live --no-pager --no-event --libmcount-path=/home/vagrant/uftrace_nh   -N memcpy /home/vagrant/uftrace_nh/tests/s-abc
uftrace: /home/vagrant/uftrace_nh/cmds/record.c:1671:check_binary
 ERROR: Can't find 'mcount' symbol in the '/home/vagrant/uftrace_nh/tests/s-abc'.
	It seems not to be compiled with -pg or -finstrument-functions flag.
	You can rebuild your program with it or use -P option for dynamic tracing.
r001_basic:  returns 1

001 basic               : NZ
  1. It fails on x86 architecture.
$ rustc +nightly -Z instrument-mcount -C passes='ee-instrument<post-inline>' s-abc.rs
$ ./runtest.py -vdp -R 001
info: using existing install for 'nightly-x86_64-unknown-linux-gnu'
info: default toolchain set to 'nightly-x86_64-unknown-linux-gnu'
Start 1 tests without worker pool

Compiler                  rustc
Runtime test case         pg
------------------------:
build command: rustc +nightly -Z instrument-mcount s-abc.rs
test command: /home/vagrant/uftrace_nh/uftrace live --no-pager --no-event --libmcount-path=/home/vagrant/uftrace_nh   -N memcpy /home/vagrant/uftrace_nh/tests/s-abc
=========== original ===========
...
===========  result  ===========
 std::rt::lang_start() {
   poll();
   signal();
   sigaction();
   sigaction();
   sigaction();
   sigaltstack();
   sysconf();
   mmap64();
   sysconf();
   mprotect();
   sysconf();
   sigaltstack();
   sysconf();
   pthread_self();
   pthread_getattr_np();
   pthread_attr_getstack();
   pthread_attr_destroy();
   malloc();
   malloc();
   __cxa_thread_atexit_impl();
   std::rt::lang_start::_{{closure}}() {
     std::sys_common::backtrace::__rust_begin_short_backtrace() {
       core::ops::function::FnOnce::call_once() {
         s_abc::main() {
           s_abc::a() {
             s_abc::b() {
               s_abc::c() {
                 getpid();
               } /* s_abc::c */
             } /* s_abc::b */
           } /* s_abc::a */
         } /* s_abc::main */
       } /* core::ops::function::FnOnce::call_once */
     } /* std::sys_common::backtrace::__rust_begin_short_backtrace */
     _<()>::report();
   } /* std::rt::lang_start::_{{closure}} */
   sigaltstack();
   sysconf();
   sysconf();
   munmap();
 } /* std::rt::lang_start */
 free();
 free();
=========== expected ===========
 getauxval();
 getauxval();
 getauxval();
 std::rt::lang_start() {
   poll();
   signal();
   sigaction();
   sigaction();
   sigaction();
   sigaltstack();
   sysconf();
   mmap64();
   sysconf();
   mprotect();
   sysconf();
   sigaltstack();
   sysconf();
   pthread_self();
   pthread_getattr_np();
   pthread_attr_getstack();
   pthread_attr_destroy();
   malloc();
   malloc();
   __cxa_thread_atexit_impl();
   std::rt::lang_start::_{{closure}}() {
     std::sys_common::backtrace::__rust_begin_short_backtrace() {
       core::ops::function::FnOnce::call_once() {
         s_abc::main() {
           s_abc::a() {
             s_abc::b() {
               s_abc::c() {
                 getpid();
               } /* s_abc::c */
             } /* s_abc::b */
           } /* s_abc::a */
         } /* s_abc::main */
       } /* core::ops::function::FnOnce::call_once */
     } /* std::sys_common::backtrace::__rust_begin_short_backtrace */
     _<()>::report();
   } /* std::rt::lang_start::_{{closure}} */
   sigaltstack();
   sysconf();
   sysconf();
   munmap();
 } /* std::rt::lang_start */
 free();
 free();
r001_basic: diff result of gcc
--- expect	2023-10-29 07:22:33.441598625 +0000
+++ result	2023-10-29 07:22:33.441598625 +0000
@@ -1,4 +1 @@
- getauxval();
- getauxval();
- getauxval();
  std::rt::lang_start() {

001 basic               : NG

@MichelleJin12
Copy link
Contributor

I think you need to delete [PATCH] from the subject of the commit message.
You can modify the signature as below to pass the DCO. :)

Signed-off-by: Paran Lee <[email protected]>
Co-authored-by: Michelle Jin <[email protected]>

@paranlee
Copy link
Contributor Author

@MichelleJin12 I tested with my rpi 4. There's something I haven't tested, I'll double check what you said. My Rust-lang version are latest version.

@paranlee
Copy link
Contributor Author

@MichelleJin12 Appreciate for review! 😊🫡

@paranlee paranlee changed the title [PATCH] tests: Add Rust basic testcase tests: Add Rust basic testcase Nov 4, 2023
@paranlee
Copy link
Contributor Author

I tested on aarch64 rpi4. Nice :)

~/uftrace/tests $ ./runtest.py -vdp -R 001
info: using existing install for 'nightly-aarch64-unknown-linux-gnu'
info: default toolchain set to 'nightly-aarch64-unknown-linux-gnu'
Start 1 tests without worker pool

Compiler                  rustc
Runtime test case         pg
------------------------:
build command: rustc +nightly -Z instrument-mcount -C passes=ee-instrument<post-inline>  -o t-abc s-abc.rs
test command: /home/kim/uftrace/uftrace live --no-pager --no-event --libmcount-path=/home/kim/uftrace   -N memcpy t-abc
=========== original ===========
# DURATION     TID     FUNCTION
   3.945 us [2040798] | getauxval();
   0.259 us [2040798] | getauxval();
   0.223 us [2040798] | getauxval();
            [2040798] | std::rt::lang_start() {
  12.314 us [2040798] |   poll();
   4.425 us [2040798] |   signal();
   2.759 us [2040798] |   sigaction();
   2.537 us [2040798] |   sigaction();
   2.611 us [2040798] |   sigaction();
   2.703 us [2040798] |   sigaltstack();
   1.148 us [2040798] |   sysconf();
  12.444 us [2040798] |   mmap64();
   0.278 us [2040798] |   sysconf();
  17.648 us [2040798] |   mprotect();
   0.352 us [2040798] |   sysconf();
   2.074 us [2040798] |   sigaltstack();
   0.203 us [2040798] |   sysconf();
   0.389 us [2040798] |   pthread_self();
 623.997 us [2040798] |   pthread_getattr_np();
   1.759 us [2040798] |   pthread_attr_getstack();
   0.445 us [2040798] |   pthread_attr_destroy();
   0.519 us [2040798] |   malloc();
   0.556 us [2040798] |   malloc();
   7.315 us [2040798] |   __cxa_thread_atexit_impl();
            [2040798] |   std::rt::lang_start::_{{closure}}() {
            [2040798] |     std::sys_common::backtrace::__rust_begin_short_backtrace() {
            [2040798] |       core::ops::function::FnOnce::call_once() {
            [2040798] |         s_abc::main() {
            [2040798] |           s_abc::a() {
            [2040798] |             s_abc::b() {
            [2040798] |               s_abc::c() {
   2.648 us [2040798] |                 getpid();
   4.870 us [2040798] |               } /* s_abc::c */
   6.074 us [2040798] |             } /* s_abc::b */
   6.703 us [2040798] |           } /* s_abc::a */
   7.408 us [2040798] |         } /* s_abc::main */
   8.111 us [2040798] |       } /* core::ops::function::FnOnce::call_once */
   8.889 us [2040798] |     } /* std::sys_common::backtrace::__rust_begin_short_backtrace */
   0.186 us [2040798] |     _<()>::report();
  10.815 us [2040798] |   } /* std::rt::lang_start::_{{closure}} */
   2.444 us [2040798] |   sigaltstack();
   0.889 us [2040798] |   sysconf();
   0.260 us [2040798] |   sysconf();
  55.092 us [2040798] |   munmap();
 830.311 us [2040798] | } /* std::rt::lang_start */
   0.389 us [2040798] | free();
   0.222 us [2040798] | free();

===========  result  ===========
 getauxval();
 getauxval();
 getauxval();
 std::rt::lang_start() {
   poll();
   signal();
   sigaction();
   sigaction();
   sigaction();
   sigaltstack();
   sysconf();
   mmap64();
   sysconf();
   mprotect();
   sysconf();
   sigaltstack();
   sysconf();
   pthread_self();
   pthread_getattr_np();
   pthread_attr_getstack();
   pthread_attr_destroy();
   malloc();
   malloc();
   __cxa_thread_atexit_impl();
   std::rt::lang_start::_{{closure}}() {
     std::sys_common::backtrace::__rust_begin_short_backtrace() {
       core::ops::function::FnOnce::call_once() {
         s_abc::main() {
           s_abc::a() {
             s_abc::b() {
               s_abc::c() {
                 getpid();
               } /* s_abc::c */
             } /* s_abc::b */
           } /* s_abc::a */
         } /* s_abc::main */
       } /* core::ops::function::FnOnce::call_once */
     } /* std::sys_common::backtrace::__rust_begin_short_backtrace */
     _<()>::report();
   } /* std::rt::lang_start::_{{closure}} */
   sigaltstack();
   sysconf();
   sysconf();
   munmap();
 } /* std::rt::lang_start */
 free();
 free();
=========== expected ===========
 getauxval();
 getauxval();
 getauxval();
 std::rt::lang_start() {
   poll();
   signal();
   sigaction();
   sigaction();
   sigaction();
   sigaltstack();
   sysconf();
   mmap64();
   sysconf();
   mprotect();
   sysconf();
   sigaltstack();
   sysconf();
   pthread_self();
   pthread_getattr_np();
   pthread_attr_getstack();
   pthread_attr_destroy();
   malloc();
   malloc();
   __cxa_thread_atexit_impl();
   std::rt::lang_start::_{{closure}}() {
     std::sys_common::backtrace::__rust_begin_short_backtrace() {
       core::ops::function::FnOnce::call_once() {
         s_abc::main() {
           s_abc::a() {
             s_abc::b() {
               s_abc::c() {
                 getpid();
               } /* s_abc::c */
             } /* s_abc::b */
           } /* s_abc::a */
         } /* s_abc::main */
       } /* core::ops::function::FnOnce::call_once */
     } /* std::sys_common::backtrace::__rust_begin_short_backtrace */
     _<()>::report();
   } /* std::rt::lang_start::_{{closure}} */
   sigaltstack();
   sysconf();
   sysconf();
   munmap();
 } /* std::rt::lang_start */
 free();
 free();
001 basic               : OK

And i tested on x86_64 WSL2 Ubuntu 20.04.

I saw some different point in the internal behavior.

~/uftrace/tests$ ./runtest.py -vdp -R 001
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: latest update on 2023-12-10, rust version 1.76.0-nightly (06e02d5b2 2023-12-09)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
info: default toolchain set to 'nightly-x86_64-unknown-linux-gnu'
Start 1 tests without worker pool

Compiler                  rustc
Runtime test case         pg
------------------------:
build command: rustc +nightly -Z instrument-mcount -C passes=ee-instrument<post-inline>  -o t-abc s-abc.rs
test command: /home/kim/uftrace/uftrace live --no-pager --no-event --libmcount-path=/home/kim/uftrace   -N memcpy t-abc
=========== original ===========
# DURATION     TID     FUNCTION
            [  6486] | std::rt::lang_start() {
            [  6486] |   std::rt::lang_start::_{{closure}}() {
            [  6486] |     std::sys_common::backtrace::__rust_begin_short_backtrace() {
            [  6486] |       core::ops::function::FnOnce::call_once() {
            [  6486] |         s_abc::main() {
            [  6486] |           s_abc::a() {
            [  6486] |             s_abc::b() {
   0.600 us [  6486] |               s_abc::c();
   1.700 us [  6486] |             } /* s_abc::b */
   2.100 us [  6486] |           } /* s_abc::a */
   2.400 us [  6486] |         } /* s_abc::main */
   2.600 us [  6486] |       } /* core::ops::function::FnOnce::call_once */
   2.800 us [  6486] |     } /* std::sys_common::backtrace::__rust_begin_short_backtrace */
   0.100 us [  6486] |     _<()>::report();
   3.400 us [  6486] |   } /* std::rt::lang_start::_{{closure}} */
 112.300 us [  6486] | } /* std::rt::lang_start */

===========  result  ===========
 std::rt::lang_start() {
   std::rt::lang_start::_{{closure}}() {
     std::sys_common::backtrace::__rust_begin_short_backtrace() {
       core::ops::function::FnOnce::call_once() {
         s_abc::main() {
           s_abc::a() {
             s_abc::b() {
               s_abc::c();
             } /* s_abc::b */
           } /* s_abc::a */
         } /* s_abc::main */
       } /* core::ops::function::FnOnce::call_once */
     } /* std::sys_common::backtrace::__rust_begin_short_backtrace */
     _<()>::report();
   } /* std::rt::lang_start::_{{closure}} */
 } /* std::rt::lang_start */
=========== expected ===========
 getauxval();
 getauxval();
 getauxval();
 std::rt::lang_start() {
   poll();
   signal();
   sigaction();
   sigaction();
   sigaction();
   sigaltstack();
   sysconf();
   mmap64();
   sysconf();
   mprotect();
   sysconf();
   sigaltstack();
   sysconf();
   pthread_self();
   pthread_getattr_np();
   pthread_attr_getstack();
   pthread_attr_destroy();
   malloc();
   malloc();
   __cxa_thread_atexit_impl();
   std::rt::lang_start::_{{closure}}() {
     std::sys_common::backtrace::__rust_begin_short_backtrace() {
       core::ops::function::FnOnce::call_once() {
         s_abc::main() {
           s_abc::a() {
             s_abc::b() {
               s_abc::c() {
                 getpid();
               } /* s_abc::c */
             } /* s_abc::b */
           } /* s_abc::a */
         } /* s_abc::main */
       } /* core::ops::function::FnOnce::call_once */
     } /* std::sys_common::backtrace::__rust_begin_short_backtrace */
     _<()>::report();
   } /* std::rt::lang_start::_{{closure}} */
   sigaltstack();
   sysconf();
   sysconf();
   munmap();
 } /* std::rt::lang_start */
 free();
 free();
r001_basic: diff result of gcc 
--- expect      2023-12-10 13:25:34.372625600 +0900
+++ result      2023-12-10 13:25:34.372625600 +0900
@@ -1,25 +1,2 @@
- getauxval();
- getauxval();
- getauxval();
  std::rt::lang_start() {
-   poll();
-   signal();
-   sigaction();
-   sigaction();
-   sigaction();
-   sigaltstack();
-   sysconf();
-   mmap64();
-   sysconf();
-   mprotect();
-   sysconf();
-   sigaltstack();
-   sysconf();
-   pthread_self();
-   pthread_getattr_np();
-   pthread_attr_getstack();
-   pthread_attr_destroy();
-   malloc();
-   malloc();
-   __cxa_thread_atexit_impl();
    std::rt::lang_start::_{{closure}}() {
@@ -30,5 +7,3 @@
              s_abc::b() {
-               s_abc::c() {
-                 getpid();
-               } /* s_abc::c */
+               s_abc::c();
              } /* s_abc::b */
@@ -40,8 +15,2 @@
    } /* std::rt::lang_start::_{{closure}} */
-   sigaltstack();
-   sysconf();
-   sysconf();
-   munmap();
  } /* std::rt::lang_start */
- free();
- free();

001 basic               : NG

@paranlee
Copy link
Contributor Author

@namhyung @honggyukim If Rust have a architectural dependent routine, How can i make answer py script?

Add Rust-lang abc test for rust uftrace supports.

Signed-off-by: Paran Lee <[email protected]>
Co-authored-by: Michelle Jin <[email protected]>
Reviewed-by: Gichoel Choi <[email protected]>
@namhyung
Copy link
Owner

Is there anything like rustc compiler option for different optimization modes like -O2 ?

@yskelg
Copy link
Contributor

yskelg commented Oct 23, 2024

When we use cargo build --release, it defaults to opt-level = 3. We can adjust the rustc command line directly with the -C opt-level=N flag. @namhyung, If applied, would opt-level=0 be appropriate?

@namhyung
Copy link
Owner

I think we can test all 0,1,2,3,s levels like we do for C/C++. Maybe it can be added to the existing runtest rather than adding a new Rust test set. But I'm not sure what's the better way. Do you think you will add a lot more tests for Rust?

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