File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
example-crates/threadsafe-setenv/src Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 6868 run : |
6969 set -ex
7070 sudo apt-get update
71- sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build
71+ sudo apt-get install -y ${{ matrix.gcc_package }} ninja-build libglib2.0-dev
7272 upcase=$(echo ${{ matrix.host_target }} | awk '{ print toupper($0) }' | sed 's/-/_/g')
7373 echo CARGO_TARGET_${upcase}_LINKER=${{ matrix.gcc }} >> $GITHUB_ENV
7474 echo CC_${{ matrix.target }}=${{ matrix.gcc }} >> $GITHUB_ENV
Original file line number Diff line number Diff line change @@ -58,6 +58,6 @@ fn lookup_localhost() {
5858fn do_getenv ( ) {
5959 for _ in 0 ..1000 {
6060 let r = std:: env:: var ( "doesnotexist" ) ;
61- assert ! ( r. is_ok( ) , "env var should not exist" ) ;
61+ assert ! ( ! r. is_ok( ) , "env var should not exist" ) ;
6262 }
6363}
Original file line number Diff line number Diff line change @@ -163,7 +163,21 @@ fn example_crate_dns() {
163163}
164164
165165#[ test]
166- fn example_crate_threadsafe_setenv ( ) {
166+ fn example_crate_threadsafe_setenv_getenv ( ) {
167+ test_crate (
168+ "threadsafe-setenv" ,
169+ & [ "try_getenv" ] ,
170+ & [ ] ,
171+ "will call std::env::set_var() 100 times ...\n \
172+ spawning thread to call std::env::var (will not crash: Rust holds lock for getenv)...\n \
173+ exiting without error\n ",
174+ "" ,
175+ None ,
176+ ) ;
177+ }
178+
179+ #[ test]
180+ fn example_crate_threadsafe_setenv_lookup ( ) {
167181 test_crate (
168182 "threadsafe-setenv" ,
169183 & [ ] ,
You can’t perform that action at this time.
0 commit comments