wrap_devenv.t (2191B)
1 # 2 # Try and wrap devenv with citrun_wrap. 3 # TODO: devenv uses response files (not supported right now). 4 # 5 use Modern::Perl; 6 use Test::Cmd; 7 use Test::More; 8 9 if ($^O eq "MSWin32") { 10 plan tests => 3; 11 } else { 12 plan skip_all => 'win32 only'; 13 } 14 15 use lib 't'; 16 require utils; 17 18 19 my $wrap = Test::Cmd->new( prog => 'citrun_wrap', workdir => '' ); 20 21 $wrap->write( 'main.vcxproj', <<'EOF' ); 22 <?xml version="1.0" encoding="utf-8"?> 23 <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 24 <ItemGroup> 25 <ProjectConfiguration Include="Debug|Win32"> 26 <Configuration>Debug</Configuration> 27 <Platform>Win32</Platform> 28 </ProjectConfiguration> 29 <ProjectConfiguration Include="Release|Win32"> 30 <Configuration>Release</Configuration> 31 <Platform>Win32</Platform> 32 </ProjectConfiguration> 33 </ItemGroup> 34 <PropertyGroup Label="Globals"> 35 <ProjectGuid>{57E3F5BB-8348-4AE5-AFA1-12C2C7BCA0CC}</ProjectGuid> 36 </PropertyGroup> 37 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.default.props" /> 38 <PropertyGroup> 39 <ConfigurationType>Application</ConfigurationType> 40 <PlatformToolset>v140</PlatformToolset> 41 </PropertyGroup> 42 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> 43 <ItemGroup> 44 <ClCompile Include="main.cpp" /> 45 </ItemGroup> 46 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Targets" /> 47 </Project> 48 EOF 49 50 $wrap->write( 'main.cpp', 'int main(void) { return 0; }' ); 51 52 $wrap->run( args => 'devenv /useenv main.vcxproj /Build', chdir => $wrap->curdir ); 53 print $wrap->stdout; 54 55 # XXX: devenv uses response files so we don't detect any source files. 56 my $log_good = <<EOF; 57 >> citrun_inst 58 Compilers path = '' 59 PATH = '' 60 Command line is '' 61 No source files found on command line. 62 Forked compiler '' 63 >> citrun_inst 64 Compilers path = '' 65 PATH = '' 66 Command line is '' 67 No source files found on command line. 68 Forked compiler '' 69 EOF 70 71 my $log_file; 72 $wrap->read( \$log_file, 'citrun.log' ); 73 $log_file = clean_citrun_log($log_file); 74 75 eq_or_diff( $log_file, $log_good, 'is devenv citrun.log identical' ); 76 is( $wrap->stderr, '', 'is citrun_wrap devenv stderr silent' ); 77 is( $? >> 8, 0, 'is citrun_wrap exit code 0' );