* Another test.
This commit is contained in:
		
							parent
							
								
									ef093aac8f
								
							
						
					
					
						commit
						a7bbe73971
					
				
					 6 changed files with 66 additions and 2 deletions
				
			
		|  | @ -10,10 +10,12 @@ TESTS_ENVIRONMENT = TEST_ROOT=$(TEST_ROOT) \ | ||||||
|   $(SHELL) -e -x |   $(SHELL) -e -x | ||||||
| 
 | 
 | ||||||
| simple.sh: simple.nix | simple.sh: simple.nix | ||||||
|  | dependencies.sh: dependencies.nix | ||||||
| 
 | 
 | ||||||
| TESTS = init.sh simple.sh | TESTS = init.sh simple.sh dependencies.sh | ||||||
| 
 | 
 | ||||||
| include ../substitute.mk | include ../substitute.mk | ||||||
| 
 | 
 | ||||||
| EXTRA_DIST = $(TESTS) \ | EXTRA_DIST = $(TESTS) \ | ||||||
|   simple.nix.in simple.builder.sh |   simple.nix.in simple.builder.sh \ | ||||||
|  |   dependencies.nix.in dependencies.builder*.sh | ||||||
|  |  | ||||||
							
								
								
									
										6
									
								
								tests/dependencies.builder0.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								tests/dependencies.builder0.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | export PATH=/bin:/usr/bin:$PATH | ||||||
|  | 
 | ||||||
|  | mkdir $out | ||||||
|  | echo $(cat $input1/foo)$(cat $input2/bar) > $out/foobar | ||||||
|  | 
 | ||||||
|  | ln -s $input2 $out/input-2 | ||||||
							
								
								
									
										4
									
								
								tests/dependencies.builder1.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								tests/dependencies.builder1.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | ||||||
|  | export PATH=/bin:/usr/bin:$PATH | ||||||
|  | 
 | ||||||
|  | mkdir $out | ||||||
|  | echo FOO > $out/foo | ||||||
							
								
								
									
										4
									
								
								tests/dependencies.builder2.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								tests/dependencies.builder2.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | ||||||
|  | export PATH=/bin:/usr/bin:$PATH | ||||||
|  | 
 | ||||||
|  | mkdir $out | ||||||
|  | echo BAR > $out/bar | ||||||
							
								
								
									
										25
									
								
								tests/dependencies.nix.in
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								tests/dependencies.nix.in
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,25 @@ | ||||||
|  | let { | ||||||
|  | 
 | ||||||
|  |   input1 = derivation { | ||||||
|  |     name = "dependencies-input-1"; | ||||||
|  |     system = "@system@"; | ||||||
|  |     builder = "@shell@"; | ||||||
|  |     args = ["-e" "-x" ./dependencies.builder1.sh]; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   input2 = derivation { | ||||||
|  |     name = "dependencies-input-2"; | ||||||
|  |     system = "@system@"; | ||||||
|  |     builder = "@shell@"; | ||||||
|  |     args = ["-e" "-x" ./dependencies.builder2.sh]; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   body = derivation { | ||||||
|  |     name = "dependencies"; | ||||||
|  |     system = "@system@"; | ||||||
|  |     builder = "@shell@"; | ||||||
|  |     args = ["-e" "-x" ./dependencies.builder0.sh]; | ||||||
|  |     inherit input1 input2; | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  | } | ||||||
							
								
								
									
										23
									
								
								tests/dependencies.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								tests/dependencies.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | ||||||
|  | storeExpr=$($TOP/src/nix-instantiate/nix-instantiate dependencies.nix) | ||||||
|  | 
 | ||||||
|  | echo "store expr is $storeExpr" | ||||||
|  | 
 | ||||||
|  | outPath=$($TOP/src/nix-store/nix-store -qnfvvvvv "$storeExpr") | ||||||
|  | 
 | ||||||
|  | echo "output path is $outPath" | ||||||
|  | 
 | ||||||
|  | text=$(cat "$outPath"/foobar) | ||||||
|  | if test "$text" != "FOOBAR"; then exit 1; fi | ||||||
|  | 
 | ||||||
|  | deps=$($TOP/src/nix-store/nix-store -qnR "$storeExpr") | ||||||
|  | 
 | ||||||
|  | echo "output closures are $deps" | ||||||
|  | 
 | ||||||
|  | # The output path should be in the closure. | ||||||
|  | echo "$deps" | grep -q "$outPath" | ||||||
|  | 
 | ||||||
|  | # Input-1 is not retained. | ||||||
|  | if echo "$deps" | grep -q "dependencies-input-1"; then exit 1; fi | ||||||
|  | 
 | ||||||
|  | # Input-2 is retained. | ||||||
|  | echo "$deps" | grep -q "dependencies-input-2" | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue