@@ -23,9 +23,6 @@ class CppLibrary
2323    # @return [ArduinoBackend] The backend support for this library 
2424    attr_reader  :backend 
2525
26-     # @return [Array<Pathname>] The set of artifacts created by this class (note: incomplete!) 
27-     attr_reader  :artifacts 
28- 
2926    # @return [Array<Pathname>] The set of directories that should be excluded from compilation 
3027    attr_reader  :exclude_dirs 
3128
@@ -50,7 +47,6 @@ def initialize(friendly_name, backend)
5047      @name  =  friendly_name 
5148      @backend  =  backend 
5249      @info_cache  =  nil 
53-       @artifacts  =  [ ] 
5450      @last_err  =  "" 
5551      @last_out  =  "" 
5652      @last_msg  =  "" 
@@ -491,13 +487,13 @@ def test_args(aux_libraries, ci_gcc_config)
491487    # @param test_file [Pathname] The path to the file containing the unit tests 
492488    # @param aux_libraries [Array<Pathname>] The external Arduino libraries required by this project 
493489    # @param ci_gcc_config [Hash] The GCC config object 
494-     # @return [Pathname] path to  the compiled test executable 
490+     # @return [Tempfile]  the compiled test executable 
495491    def  build_for_test_with_configuration ( test_file ,  aux_libraries ,  gcc_binary ,  ci_gcc_config ) 
496492      base  =  test_file . basename 
497-       executable  =  Pathname . new ( "unittest_#{ base }  .bin" ) . expand_path 
498-       File . delete ( executable )   if   File . exist? ( executable ) 
493+       executable  =  Tempfile . new ( "unittest_#{ base }  .bin" ) 
494+       executable . close 
499495      arg_sets  =  [ ] 
500-       arg_sets  << [ "-std=c++0x" ,  "-o" ,  executable . to_s ,  "-DARDUINO=100" ] 
496+       arg_sets  << [ "-std=c++0x" ,  "-o" ,  executable . path ,  "-DARDUINO=100" ] 
501497      if  libasan? ( gcc_binary ) 
502498        arg_sets  << [  # Stuff to help with dynamic memory mishandling 
503499          "-g" ,  "-O1" , 
@@ -514,17 +510,20 @@ def build_for_test_with_configuration(test_file, aux_libraries, gcc_binary, ci_g
514510      arg_sets  << cpp_files_libraries ( full_dependencies ) . map ( &:to_s ) 
515511      arg_sets  << [ test_file . to_s ] 
516512      args  =  arg_sets . flatten ( 1 ) 
517-       return  nil  unless  run_gcc ( gcc_binary ,  *args ) 
513+       unless  run_gcc ( gcc_binary ,  *args ) 
514+         executable . unlink 
515+         return  nil 
516+       end 
518517
519-       artifacts  << executable 
520518      executable 
521519    end 
522520
523521    # print any found stack dumps 
524-     # @param executable [Pathname ] the path to the test file 
522+     # @param executable [Tempfile ] the path to the test file 
525523    def  print_stack_dump ( executable ) 
524+       path  =  Pathname . new ( executable . path ) 
526525      possible_dumpfiles  =  [ 
527-         executable . sub_ext ( "#{ executable . extname }  .stackdump" ) 
526+         path . sub_ext ( "#{ path . extname }  .stackdump" ) 
528527      ] 
529528      possible_dumpfiles . select ( &:exist? ) . each  do  |dump |
530529        puts  "========== Stack dump from #{ dump }  :" 
0 commit comments