[darcs-users] [patch374] ADV: the initial pile
Petr Ročkai
bugs at darcs.net
Mon Aug 30 08:43:30 UTC 2010
New submission from Petr RoÄkai <me at mornfall.net>:
Hi!
In between the discussions about how to actually organise the adventure branch,
I have taken the liberty to start hacking on it.
The first pile of patches is a *bit* of a powerplant maybe, on the other hand
it also contains a couple of previously submitted bundles that are blocking
somewhere in review, partially due to their adventure-appropriateness. It would
be good if people could take it apart and start applying the easier part and
maybe discuss the harder (the latter group mostly contains the new annotate
code).
In effect, patch 351 (optimize diff) and 343 (hashed-storage 0.6 aka path
refactor) are obsoleted by this patch. They will hopefully get to mainline
through the adventure branch at some point.
I have also cloned HEAD as darcs-unstable at darcs.net:adventure (also available
as http://darcs.net/adventure) where I imagine these patches would go. I'll set
up a buildbot waterfall for it when people start pushing patches there.
As a sneak preview, you can find the new annotate in action. However please
note, that it is common that the speedup is just a factor of 3 - 10, in this
case the difference is fairly extreme.
Yours,
Petr.
61 patches for repository http://darcs.net:
Wed Jul 14 19:52:08 CEST 2010 Petr Rockai <me at mornfall.net>
* Wibble path building in Repository.Prefs.
Thu Jul 15 10:59:38 CEST 2010 Petr Rockai <me at mornfall.net>
* Use more meaningful names for seal_up_patches' parameters.
Sat Jul 17 10:40:48 CEST 2010 Petr Rockai <me at mornfall.net>
* Update haddock.
Wed Aug 11 17:39:29 CEST 2010 Petr Rockai <me at mornfall.net>
* First stab at a hashed-storage 0.6 port.
Wed Aug 11 21:25:55 CEST 2010 Petr Rockai <me at mornfall.net>
* Move the preferences system into IO where it belongs.
Wed Aug 11 21:45:04 CEST 2010 Petr Rockai <me at mornfall.net>
* Make FileName an alias to Relative (from Hashed.Storage.Path).
Wed Aug 11 22:12:49 CEST 2010 Petr Rockai <me at mornfall.net>
* Fix annotate that got broken due to path format change.
Thu Aug 12 00:02:43 CEST 2010 Petr Rockai <me at mornfall.net>
* Replace FilePath with FileName in SelectChanges and ChooseTouching.
Thu Aug 12 00:09:46 CEST 2010 Petr Rockai <me at mornfall.net>
* Make SubPath just another alias for Relative.
Thu Aug 12 00:16:21 CEST 2010 Petr Rockai <me at mornfall.net>
* Introduce a new Darcs.Path module to centralise path handling.
Thu Aug 12 00:36:15 CEST 2010 Petr Rockai <me at mornfall.net>
* Merge Darcs.Patch.FileName into Darcs.Path.
Thu Aug 12 00:47:39 CEST 2010 Petr Rockai <me at mornfall.net>
* Remove the now-redundant sp2fn.
Thu Aug 12 01:05:34 CEST 2010 Petr Rockai <me at mornfall.net>
* Fix announceFiles in WhatsNew (abolish unsafePathFrom*).
Thu Aug 12 01:06:04 CEST 2010 Petr Rockai <me at mornfall.net>
* Restore the ".." check in isMaliciousPath.
Thu Aug 12 01:29:40 CEST 2010 Petr Rockai <me at mornfall.net>
* Fix a subtle bug in onlyHunks with rather curious side-effects.
Thu Aug 12 01:30:27 CEST 2010 Petr Rockai <me at mornfall.net>
* Merge Darcs.RepoPath into Darcs.Path.
Thu Aug 12 01:31:25 CEST 2010 Petr Rockai <me at mornfall.net>
* Drop unused and redundant pathFromFileName.
Thu Aug 12 01:32:08 CEST 2010 Petr Rockai <me at mornfall.net>
* Make the tests pass (mostly ./foo versus foo in user-visible output).
Wed Aug 18 22:53:38 CEST 2010 Petr Rockai <me at mornfall.net>
* Optimize darcs diff.
Sun Aug 29 18:30:19 CEST 2010 Petr Rockai <me at mornfall.net>
* Resolve hashed-storage dependency conflicts.
Sun Aug 29 18:30:33 CEST 2010 Petr Rockai <me at mornfall.net>
* Resolve conflict in Commands.Diff imports.
Sun Aug 29 18:30:50 CEST 2010 Petr Rockai <me at mornfall.net>
* Resolve conflicts in Commands.WhatsNew imports.
Sun Aug 29 18:31:05 CEST 2010 Petr Rockai <me at mornfall.net>
* Fix conflicts in Darcs.Diff.
Sun Aug 29 18:31:15 CEST 2010 Petr Rockai <me at mornfall.net>
* Resolve conflicts in Darcs.Patch.*.
Fri Aug 27 22:44:48 CEST 2010 Petr Rockai <me at mornfall.net>
* Implement a test-framework-based shell harness.
This merges the two test drivers we previously had, "unit" and
Distribution.ShellHarness (used directly by Setup), into a single "darcs-test"
binary. This patch only goes half the way, though: the new shell harness is not
used by "cabal test" yet. That will come as a separate patch.
Sat Aug 28 00:03:53 CEST 2010 Petr Rockai <me at mornfall.net>
* Couple of improvements in the new shell test runner.
Sat Aug 28 00:04:14 CEST 2010 Petr Rockai <me at mornfall.net>
* Add a --network option to darcs-test to run the network shell tests.
Sat Aug 28 00:04:54 CEST 2010 Petr Rockai <me at mornfall.net>
* Flip "cabal test" over to use darcs-test to run the shell tests.
Sun Aug 29 15:47:47 CEST 2010 Petr Rockai <me at mornfall.net>
* Bump shellish dependency to >= 0.1.1, to avoid the infinite loop in rm_rf problem.
Sun Aug 29 15:56:23 CEST 2010 Petr Rockai <me at mornfall.net>
* Drop the "test" cabal flag and build darcs-test unconditionally.
Sun Aug 29 18:45:45 CEST 2010 Petr Rockai <me at mornfall.net>
* Make it possible to pass "threads=N" to cabal test.
Sun Aug 29 18:46:13 CEST 2010 Petr Rockai <me at mornfall.net>
* Resolve a (bogus?) conflict in darcs.cabal.
Sun Aug 29 18:51:11 CEST 2010 Petr Rockai <me at mornfall.net>
* First round of OF removal.
Sun Aug 29 18:53:36 CEST 2010 Petr Rockai <me at mornfall.net>
* Also remove support for getting old-fashioned (to hashed).
Sun Aug 29 18:54:41 CEST 2010 Petr Rockai <me at mornfall.net>
* Only test Darcs2 and Hashed (and not OF).
Sun Aug 29 19:14:28 CEST 2010 Petr Rockai <me at mornfall.net>
* Set a $format variable in lib, depending on current repo format under test.
Sun Aug 29 19:15:01 CEST 2010 Petr Rockai <me at mornfall.net>
* Make the tests a bit less verbose (do not print all of lib every time).
Sun Aug 29 19:15:18 CEST 2010 Petr Rockai <me at mornfall.net>
* Modernize the conflict-doppleganger test.
Sun Aug 29 19:15:38 CEST 2010 Petr Rockai <me at mornfall.net>
* Fix a bug in cabal test argument parsing.
Sun Aug 29 19:16:00 CEST 2010 Petr Rockai <me at mornfall.net>
* Fix up the module list in darcs.cabal.
Sun Aug 29 19:16:18 CEST 2010 Petr Rockai <me at mornfall.net>
* Update couple more tests for absence of OF.
Sun Aug 29 19:43:58 CEST 2010 Petr Rockai <me at mornfall.net>
* Fix the optimize --upgrade functionality.
Sun Aug 29 19:44:48 CEST 2010 Petr Rockai <me at mornfall.net>
* Add a tarball of a small oldfashioned repository for testing purposes.
Sun Aug 29 19:57:34 CEST 2010 Petr Rockai <me at mornfall.net>
* Adapt bad-format to the current OF-less situation.
Sun Aug 29 19:57:50 CEST 2010 Petr Rockai <me at mornfall.net>
* Adapt issue1248 test to current OF-less situation.
Sun Aug 29 19:58:18 CEST 2010 Petr Rockai <me at mornfall.net>
* Remove parts of the hashed_inventory that require conversion to OF.
Sun Aug 29 19:58:46 CEST 2010 Petr Rockai <me at mornfall.net>
* Getting OF repos is not supported, reflect that in Commands.Get.
Sun Aug 29 21:14:09 CEST 2010 Petr Rockai <me at mornfall.net>
* Correctly fail on encountering unsupported repository format in Commands.Get.
Sun Aug 29 21:14:46 CEST 2010 Petr Rockai <me at mornfall.net>
* Remove redundant imports from Commands.Get.
Sun Aug 29 21:15:00 CEST 2010 Petr Rockai <me at mornfall.net>
* Print a list of (shell) tests that have failed after a test run.
Sun Aug 29 21:15:37 CEST 2010 Petr Rockai <me at mornfall.net>
* Fix a few more tests since the OF support removal.
Sun Aug 29 21:17:17 CEST 2010 Petr Rockai <me at mornfall.net>
* Remove the now-defunct Distribution directory.
Mon Aug 30 01:09:43 CEST 2010 Petr Rockai <me at mornfall.net>
* A new implementation of per-file annotate, part one.
Mon Aug 30 01:16:51 CEST 2010 Petr Rockai <me at mornfall.net>
* A slight improvement to file annotate performance.
Mon Aug 30 01:22:17 CEST 2010 Petr Rockai <me at mornfall.net>
* Avoid a bogus trailing empty line in annotate output.
Mon Aug 30 01:24:04 CEST 2010 Petr Rockai <me at mornfall.net>
* Fix the annotation of the first line.
Mon Aug 30 09:46:28 CEST 2010 Petr Rockai <me at mornfall.net>
* Use linesPS in patch application -- the trailing empty line is significant.
Mon Aug 30 09:47:54 CEST 2010 Petr Rockai <me at mornfall.net>
* Use fluffier and more readable formatting for annotate.
Mon Aug 30 10:17:54 CEST 2010 Petr Rockai <me at mornfall.net>
* Cut the old annotate code from Commands.Annotate.
Mon Aug 30 10:24:56 CEST 2010 Petr Rockai <me at mornfall.net>
* Remove the Population code (part of the old annotate implementation).
Mon Aug 30 10:29:42 CEST 2010 Petr Rockai <me at mornfall.net>
* Make the annotate formatting ever so fluffier.
darcs annotate src/test.hs 8,69s user 0,46s system 99% cpu 9,199 total
[snip]
darcs-ADV annotate src/test.hs 0,08s user 0,01s system 93% cpu 0,102 total
1: Wed Jul 7 20:06:00 CEST 2010 Ganesh Sittampalam <ganesh at earth.li>
* move main unit testing code into module with proper name (not Main)
This is enable other things than the unit executable to import it
2: Fri Aug 27 22:44:48 CEST 2010 Petr Rockai <me at mornfall.net>
* Implement a test-framework-based shell harness.
This merges the two test drivers we previously had, "unit" and
Distribution.ShellHarness (used directly by Setup), into a single "darcs-test"
binary. This patch only goes half the way, though: the new shell harness is not
used by "cabal test" yet. That will come as a separate patch.
3: Sun Aug 29 21:15:00 CEST 2010 Petr Rockai <me at mornfall.net>
* Print a list of (shell) tests that have failed after a test run.
4: Sat Aug 28 00:03:53 CEST 2010 Petr Rockai <me at mornfall.net>
* Couple of improvements in the new shell test runner.
5: Sat Aug 28 00:04:14 CEST 2010 Petr Rockai <me at mornfall.net>
* Add a --network option to darcs-test to run the network shell tests.
ganesh at earth.li #1 | module Main ( main ) where
me at mornfall.net #2 | import Test.Framework.Runners.Console ( defaultMain )
| import qualified Darcs.Test.Unit as Unit
| import Data.List ( isPrefixOf, isSuffixOf, sort )
| import qualified Data.ByteString.Char8 as B
| import System.Console.CmdLib hiding ( run )
| import qualified System.Console.CmdLib as CmdLib
| import System.FilePath( takeDirectory )
me at mornfall.net #3 | import Control.Concurrent.MVar
| import Control.Exception( finally )
ganesh at earth.li #1 |
me at mornfall.net #2 | import Test.Framework.Providers.API
| import Test.Framework
| import Shellish hiding ( liftIO )
me at mornfall.net #3 | import qualified Control.Monad.Trans as Trans
me at mornfall.net #2 |
| data Format = Hashed | Darcs2 | OldFashioned deriving Show
| data Running = Running deriving Show
| data Result = Success | Skipped | Failed String
|
| instance Show Result where
| show Success = "Success"
| show Skipped = "Skipped"
| show (Failed f) = unlines (map ("| " ++) $ lines f)
|
| instance TestResultlike Running Result where
| testSucceeded Success = True
| testSucceeded Skipped = True
| testSucceeded _ = False
|
| data ShellTest = ShellTest { format :: Format
| , file :: FilePath
me at mornfall.net #3 | , darcspath :: FilePath
| , failedlist :: MVar [String] }
|
| fmtstr Darcs2 = "darcs-2"
| fmtstr Hashed = "hashed"
| fmtstr OldFashioned = "old-fashioned-inventory"
me at mornfall.net #2 |
me at mornfall.net #4 | runtest' :: ShellTest -> FilePath -> ShIO Result
me at mornfall.net #3 | runtest' (ShellTest fmt file dp ref) srcdir =
me at mornfall.net #2 | do wd <- pwd
| setenv "HOME" wd
| setenv "TESTDATA" (srcdir </> "tests" </> "data")
| setenv "TESTBIN" (srcdir </> "tests" </> "bin")
| setenv "DARCS_TESTING_PREFS_DIR" $ wd </> ".darcs"
| setenv "EMAIL" "tester"
| setenv "DARCS_DONT_COLOR" "1"
| setenv "DARCS_DONT_ESCAPE_ANYTHING" "1"
| getenv "PATH" >>= setenv "PATH" . ((takeDirectory dp ++ ":") ++)
| setenv "DARCS" dp
| mkdir ".darcs"
| writefile ".darcs/defaults" defaults
| run "bash" [ "test" ]
| return Success
| `catch_sh` \e -> case e of
| RunFailed _ 200 _ -> return Skipped
me at mornfall.net #3 | RunFailed _ n _ -> do
| Trans.liftIO $ modifyMVar_ ref $ \bad -> return $ (fmtstr fmt ++ ": " ++ file) : bad
| Failed <$> B.unpack <$> lastOutput
| where defaults = unlines ["ALL " ++ fmtstr fmt, "send no-edit-description", "ALL ignore-times"]
me at mornfall.net #2 |
| runtest :: ShellTest -> ShIO Result
| runtest t = withTmpDir $ \dir -> do
| cp "tests/lib" dir
| cp ("tests" </> file t) (dir </> "test")
| srcdir <- pwd
me at mornfall.net #4 | silently $ sub $ cd dir >> runtest' t srcdir
me at mornfall.net #2 |
| instance Testlike Running Result ShellTest where
| testTypeName _ = "Shell"
me at mornfall.net #4 | runTest topts test = runImprovingIO $ do yieldImprovement Running
| liftIO (shellish $ runtest test)
me at mornfall.net #2 |
me at mornfall.net #3 | shellTest :: FilePath -> Format -> String -> MVar [String] -> Test
| shellTest dp fmt file ref =
| Test (fmtstr fmt ++ ": " ++ file) $ ShellTest fmt file dp ref
me at mornfall.net #2 |
me at mornfall.net #3 | findShell :: FilePath -> Bool -> ShIO ([Test], MVar [String])
me at mornfall.net #2 | findShell dp failing =
| do files <- sort <$> grep relevant <$> grep (".sh" `isSuffixOf`) <$> ls "tests"
me at mornfall.net #3 | ref <- Trans.liftIO $ newMVar []
| return ([ shellTest dp format file ref
| | format <- [ Darcs2, Hashed ]
| , file <- files ], ref)
me at mornfall.net #2 | where relevant = (if failing then id else not) . ("failing-" `isPrefixOf`)
|
me at mornfall.net #5 | findNetwork :: FilePath -> ShIO [Test]
| findNetwork dp = do files <- sort <$> grep (".sh" `isSuffixOf`) <$> ls "tests/network"
me at mornfall.net #3 | ref <- Trans.liftIO $ newMVar []
| return [ shellTest dp Darcs2 ("network" </> file) ref | file <- files ]
me at mornfall.net #5 |
me at mornfall.net #2 | data Config = Config { failing :: Bool
| , shell :: Bool
me at mornfall.net #5 | , network :: Bool
me at mornfall.net #2 | , unit :: Bool
| , darcs :: String
| , tests :: [String]
| , threads :: Int }
| deriving (Data, Typeable, Eq)
|
| instance Attributes Config where
| attributes _ = group "Options"
| [ failing %> Help "Run the failing (shell) tests."
me at mornfall.net #5 | , shell %> Help "Run the passing, non-network shell tests." %+ Default True
| , network %> Help "Run the network shell tests."
me at mornfall.net #2 | , unit %> Help "Run the unit tests." %+ Default True
| , tests %> Help "Pattern to limit the tests to run." %+ short 't'
| , threads %> Default (1 :: Int) %+ short 'j' ]
|
| data DarcsTest = DarcsTest deriving Typeable
| instance Command DarcsTest (Record Config) where
| run _ conf _ = do
| let args = [ "-j", show $ threads conf ] ++ concat [ ["-t", x ] | x <- tests conf ]
me at mornfall.net #3 | nullref <- newMVar []
| (ftests, _) <- shellish $ if failing conf then findShell (darcs conf) True
| else return ([], nullref)
| (stests, sfail) <- shellish $ if shell conf then findShell (darcs conf) False
| else return ([], nullref)
me at mornfall.net #2 | utests <- if unit conf then Unit.unit else return []
me at mornfall.net #5 | ntests <- shellish $ if network conf then findNetwork (darcs conf) else return []
me at mornfall.net #3 | defaultMainWithArgs (ftests ++ stests ++ utests ++ ntests) args `finally`
| (readMVar sfail >>= \x -> case x of
| [] -> return ()
| bad -> putStr $ "The following Shell tests failed:\n" ++ unlines bad)
me at mornfall.net #2 |
| main :: IO ()
| main = getArgs >>= execute DarcsTest
----------
files: unnamed, wibble-path-building-in-repository_prefs_.dpatch
messages: 12375
nosy: mornfall
status: needs-review
title: ADV: the initial pile
__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/patch374>
__________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wibble-path-building-in-repository_prefs_.dpatch
Type: text/x-darcs-patch
Size: 475805 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20100830/18135b83/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unnamed
Type: application/octet-stream
Size: 5 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20100830/18135b83/attachment-0001.obj>
More information about the darcs-users
mailing list