|  | @@ -26,3 +26,26 @@ ${name}')
 | 
	
		
			
				|  |  |  cd /var/local/git/grpc
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  bazel build :all //test/... //examples/...
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +BUILD_WITH_XDS_SIZE=$(stat -c %s "bazel-bin/test/cpp/end2end/end2end_test")
 | 
	
		
			
				|  |  | +# TODO(jtattersmusch): Adding a build here for --define=grpc_no_xds is not ideal
 | 
	
		
			
				|  |  | +# and we should find a better place for this. Refer
 | 
	
		
			
				|  |  | +# https://github.com/grpc/grpc/pull/24536#pullrequestreview-517466531 for more
 | 
	
		
			
				|  |  | +# details.
 | 
	
		
			
				|  |  | +# Test that builds with --define=grpc_no_xds=true work.
 | 
	
		
			
				|  |  | +bazel build //test/cpp/end2end:end2end_test --define=grpc_no_xds=true
 | 
	
		
			
				|  |  | +BUILD_WITHOUT_XDS_SIZE=$(stat -c %s "bazel-bin/test/cpp/end2end/end2end_test")
 | 
	
		
			
				|  |  | +# Test that the binary size with --define=grpc_no_xds=true is smaller
 | 
	
		
			
				|  |  | +if [ $BUILD_WITH_XDS_SIZE -le $BUILD_WITHOUT_XDS_SIZE ]
 | 
	
		
			
				|  |  | +then
 | 
	
		
			
				|  |  | +	echo "Building with --define=grpc_no_xds=true does not reduce binary size"
 | 
	
		
			
				|  |  | +	exit 1
 | 
	
		
			
				|  |  | +fi
 | 
	
		
			
				|  |  | +# Test that builds that need xDS do not build with --define=grpc_no_xds=true
 | 
	
		
			
				|  |  | +EXIT_CODE=0
 | 
	
		
			
				|  |  | +bazel build //test/cpp/end2end:xds_end2end_test --define=grpc_no_xds=true || EXIT_CODE=$?
 | 
	
		
			
				|  |  | +if [ $EXIT_CODE -eq 0 ]
 | 
	
		
			
				|  |  | +then
 | 
	
		
			
				|  |  | +	echo "Building xds_end2end_test succeeded even with --define=grpc_no_xds=true"
 | 
	
		
			
				|  |  | +	exit 1
 | 
	
		
			
				|  |  | +fi
 |