cleanup
This commit is contained in:
		
					parent
					
						
							
								ecca55ae85
							
						
					
				
			
			
				commit
				
					
						c3e19d65e4
					
				
			
		
					 1 changed files with 15 additions and 20 deletions
				
			
		
							
								
								
									
										35
									
								
								Test.hs
									
										
									
									
									
								
							
							
						
						
									
										35
									
								
								Test.hs
									
										
									
									
									
								
							| 
						 | 
					@ -213,7 +213,7 @@ test_reinject env = "git-annex reinject/fromkey" ~: TestCase $ intmpclonerepo en
 | 
				
			||||||
		Types.KeySource.KeySource { Types.KeySource.keyFilename = tmp, Types.KeySource.contentLocation = tmp, Types.KeySource.inodeCache = Nothing }
 | 
							Types.KeySource.KeySource { Types.KeySource.keyFilename = tmp, Types.KeySource.contentLocation = tmp, Types.KeySource.inodeCache = Nothing }
 | 
				
			||||||
	let key = Types.Key.key2file $ fromJust r
 | 
						let key = Types.Key.key2file $ fromJust r
 | 
				
			||||||
	git_annex env "reinject" [tmp, sha1annexedfile] @? "reinject failed"
 | 
						git_annex env "reinject" [tmp, sha1annexedfile] @? "reinject failed"
 | 
				
			||||||
	git_annex env "fromkey" [key, sha1annexedfiledup] @? "fromkey failed"
 | 
						git_annex env "fromkey" [key, sha1annexedfiledup] @? "fromkey failed for dup"
 | 
				
			||||||
	annexed_present sha1annexedfiledup
 | 
						annexed_present sha1annexedfiledup
 | 
				
			||||||
  where
 | 
					  where
 | 
				
			||||||
	tmp = "tmpfile"
 | 
						tmp = "tmpfile"
 | 
				
			||||||
| 
						 | 
					@ -866,12 +866,10 @@ cleanup dir = do
 | 
				
			||||||
checklink :: FilePath -> Assertion
 | 
					checklink :: FilePath -> Assertion
 | 
				
			||||||
checklink f = do
 | 
					checklink f = do
 | 
				
			||||||
	s <- getSymbolicLinkStatus f
 | 
						s <- getSymbolicLinkStatus f
 | 
				
			||||||
	ifM (annexeval Config.isDirect)
 | 
						-- in direct mode, it may be a symlink, or not, depending
 | 
				
			||||||
		-- in direct mode, it may be a symlink, or not, depending
 | 
						-- on whether the content is present.
 | 
				
			||||||
		-- on whether the content is present.
 | 
						unlessM (annexeval Config.isDirect) $
 | 
				
			||||||
		( return ()
 | 
							isSymbolicLink s @? f ++ " is not a symlink"
 | 
				
			||||||
		, isSymbolicLink s @? f ++ " is not a symlink"
 | 
					 | 
				
			||||||
		)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
checkregularfile :: FilePath -> Assertion
 | 
					checkregularfile :: FilePath -> Assertion
 | 
				
			||||||
checkregularfile f = do
 | 
					checkregularfile f = do
 | 
				
			||||||
| 
						 | 
					@ -882,21 +880,18 @@ checkregularfile f = do
 | 
				
			||||||
checkcontent :: FilePath -> Assertion
 | 
					checkcontent :: FilePath -> Assertion
 | 
				
			||||||
checkcontent f = do
 | 
					checkcontent f = do
 | 
				
			||||||
	c <- readFile f
 | 
						c <- readFile f
 | 
				
			||||||
	assertEqual ("checkcontent " ++ f) c (content f)
 | 
						assertEqual ("checkcontent " ++ f) (content f) c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
checkunwritable :: FilePath -> Assertion
 | 
					checkunwritable :: FilePath -> Assertion
 | 
				
			||||||
checkunwritable f = ifM (annexeval Config.isDirect)
 | 
					checkunwritable f = unlessM (annexeval Config.isDirect) $ do
 | 
				
			||||||
	( return ()
 | 
						-- Look at permissions bits rather than trying to write or
 | 
				
			||||||
	, do
 | 
						-- using fileAccess because if run as root, any file can be
 | 
				
			||||||
		-- Look at permissions bits rather than trying to write or
 | 
						-- modified despite permissions.
 | 
				
			||||||
		-- using fileAccess because if run as root, any file can be
 | 
						s <- getFileStatus f
 | 
				
			||||||
		-- modified despite permissions.
 | 
						let mode = fileMode s
 | 
				
			||||||
		s <- getFileStatus f
 | 
						if (mode == mode `unionFileModes` ownerWriteMode)
 | 
				
			||||||
		let mode = fileMode s
 | 
							then assertFailure $ "able to modify annexed file's " ++ f ++ " content"
 | 
				
			||||||
		if (mode == mode `unionFileModes` ownerWriteMode)
 | 
							else return ()
 | 
				
			||||||
			then assertFailure $ "able to modify annexed file's " ++ f ++ " content"
 | 
					 | 
				
			||||||
			else return ()
 | 
					 | 
				
			||||||
	)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
checkwritable :: FilePath -> Assertion
 | 
					checkwritable :: FilePath -> Assertion
 | 
				
			||||||
checkwritable f = do
 | 
					checkwritable f = do
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue