@@ -726,6 +726,42 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
726
726
end
727
727
end
728
728
729
+ let exename = ` $(Base. julia_cmd (; cpu_target= " native;native" )) --startup-file=no --color=no`
730
+ # --pkgimages with multiple cpu targets
731
+ @testset let v = readchomperrors (` $exename --pkgimages=no` )
732
+ @test ! v[1 ]
733
+ @test isempty (v[2 ])
734
+ @test v[3 ] == " ERROR: More than one command line CPU targets specified without a `--output-` flag specified"
735
+ end
736
+
737
+ @test readchomp (` $exename --pkgimages=yes -e '
738
+ println("cpu_target = $(unsafe_string (Base. JLOptions (). cpu_target)) and use_pkgimages = $(Base. JLOptions (). use_pkgimages) ")'` ) ==
739
+ " cpu_target = native;native and use_pkgimages = 1"
740
+ end
741
+
742
+ # Object file with multiple cpu targets
743
+ @testset " Object file for multiple microarchitectures" begin
744
+ julia_path = joinpath (Sys. BINDIR, Base. julia_exename ())
745
+ outputo_file = tempname ()
746
+ write (outputo_file, " 1" )
747
+ object_file = tempname () * " .o"
748
+
749
+ # This is to test that even with `pkgimages=no`, we can create object file
750
+ # with multiple cpu-targets
751
+ # The cmd is checked for `--object-o` as soon as it is run. So, to avoid long
752
+ # testing times, intentionally don't pass `--sysimage`; when we reach the
753
+ # corresponding error, we know that `check_cmdline` has already passed
754
+ let v = readchomperrors (` $julia_path
755
+ --cpu-target='native;native'
756
+ --output-o=$object_file $outputo_file
757
+ --pkgimages=no` )
758
+
759
+ @test v[1 ] == false
760
+ @test v[2 ] == " "
761
+ @test ! contains (v[3 ], " More than one command line CPU targets specified" )
762
+ @test v[3 ] == " ERROR: File \" boot.jl\" not found"
763
+ end
764
+ end
729
765
730
766
# Find the path of libjulia (or libjulia-debug, as the case may be)
731
767
# to use as a dummy shlib to open
0 commit comments