1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-13 20:53:02 +01:00
git/contrib/mw-to-git/t
Junio C Hamano 6753d8a85d Merge branch 'ep/shell-command-substitution'
Adjust shell scripts to use $(cmd) instead of `cmd`.

* ep/shell-command-substitution: (41 commits)
  t5000-tar-tree.sh: use the $( ... ) construct for command substitution
  t4204-patch-id.sh: use the $( ... ) construct for command substitution
  t4119-apply-config.sh: use the $( ... ) construct for command substitution
  t4116-apply-reverse.sh: use the $( ... ) construct for command substitution
  t4057-diff-combined-paths.sh: use the $( ... ) construct for command substitution
  t4038-diff-combined.sh: use the $( ... ) construct for command substitution
  t4036-format-patch-signer-mime.sh: use the $( ... ) construct for command substitution
  t4014-format-patch.sh: use the $( ... ) construct for command substitution
  t4013-diff-various.sh: use the $( ... ) construct for command substitution
  t4012-diff-binary.sh: use the $( ... ) construct for command substitution
  t4010-diff-pathspec.sh: use the $( ... ) construct for command substitution
  t4006-diff-mode.sh: use the $( ... ) construct for command substitution
  t3910-mac-os-precompose.sh: use the $( ... ) construct for command substitution
  t3905-stash-include-untracked.sh: use the $( ... ) construct for command substitution
  t1050-large.sh: use the $( ... ) construct for command substitution
  t1020-subdirectory.sh: use the $( ... ) construct for command substitution
  t1004-read-tree-m-u-wf.sh: use the $( ... ) construct for command substitution
  t1003-read-tree-prefix.sh: use the $( ... ) construct for command substitution
  t1002-read-tree-m-u-2way.sh: use the $( ... ) construct for command substitution
  t1001-read-tree-m-2way.sh: use the $( ... ) construct for command substitution
  ...
2014-06-03 12:06:45 -07:00
..
install-wiki git-remote-mediawiki: spelling fixes 2013-04-12 12:13:05 -07:00
.gitignore
install-wiki.sh git-remote-mediawiki: allow stop/start-ing the test server 2014-04-23 15:22:53 -07:00
Makefile
push-pull-tests.sh git-remote-mediawiki: fix incorrect test usage in test 2012-07-17 11:51:45 -07:00
README git-remote-mediawiki: spelling fixes 2013-04-12 12:13:05 -07:00
t9360-mw-to-git-clone.sh t9360-mw-to-git-clone.sh: use the $( ... ) construct for command substitution 2014-04-17 11:15:01 -07:00
t9361-mw-to-git-push-pull.sh git-remote-mediawiki (t9361): test git-remote-mediawiki pull and push 2012-07-06 12:20:46 -07:00
t9362-mw-to-git-utf8.sh t9362-mw-to-git-utf8.sh: use the $( ... ) construct for command substitution 2014-04-17 11:15:01 -07:00
t9363-mw-to-git-export-import.sh git-remote-mediawiki: fix encoding issue for UTF-8 media files 2014-04-23 15:22:54 -07:00
t9364-pull-by-rev.sh git-remote-mediawiki: more efficient 'pull' in the best case 2012-07-06 12:20:46 -07:00
t9365-continuing-queries.sh t9365-continuing-queries.sh: use the $( ... ) construct for command substitution 2014-04-23 15:17:01 -07:00
test-gitmw-lib.sh Merge branch 'ep/shell-command-substitution' 2014-06-03 12:06:45 -07:00
test-gitmw.pl git-remote-mediawiki: support for uploading file in test environment 2012-07-06 12:20:46 -07:00
test.config contrib: typofixes 2013-11-12 09:42:21 -08:00

Tests for Mediawiki-to-Git
==========================

Introduction
------------
This manual describes how to install the git-remote-mediawiki test
environment on a machine with git installed on it.

Prerequisite
------------

In order to run this test environment correctly, you will need to
install the following packages (Debian/Ubuntu names, may need to be
adapted for another distribution):

* lighttpd
* php5
* php5-cgi
* php5-cli
* php5-curl
* php5-sqlite

Principles and Technical Choices
--------------------------------

The test environment makes it easy to install and manipulate one or
several MediaWiki instances. To allow developers to run the testsuite
easily, the environment does not require root privilege (except to
install the required packages if needed). It starts a webserver
instance on the user's account (using lighttpd greatly helps for
that), and does not need a separate database daemon (thanks to the use
of sqlite).

Run the test environment
------------------------

Install a new wiki
~~~~~~~~~~~~~~~~~~

Once you have all the prerequisite, you need to install a MediaWiki
instance on your machine. If you already have one, it is still
strongly recommended to install one with the script provided. Here's
how to work it:

a. change directory to contrib/mw-to-git/t/
b. if needed, edit test.config to choose your installation parameters
c. run `./install-wiki.sh install`
d. check on your favourite web browser if your wiki is correctly
   installed.

Remove an existing wiki
~~~~~~~~~~~~~~~~~~~~~~~

Edit the file test.config to fit the wiki you want to delete, and then
execute the command `./install-wiki.sh delete` from the
contrib/mw-to-git/t directory.

Run the existing tests
~~~~~~~~~~~~~~~~~~~~~~

The provided tests are currently in the `contrib/mw-to-git/t` directory.
The files are all the t936[0-9]-*.sh shell scripts.

a. Run all tests:
To do so, run "make test" from the contrib/mw-to-git/ directory.

b. Run a specific test:
To run a given test <test_name>, run ./<test_name> from the
contrib/mw-to-git/t directory.

How to create new tests
-----------------------

Available functions
~~~~~~~~~~~~~~~~~~~

The test environment of git-remote-mediawiki provides some functions
useful to test its behaviour. for more details about the functions'
parameters, please refer to the `test-gitmw-lib.sh` and
`test-gitmw.pl` files.

** `test_check_wiki_precond`:
Check if the tests must be skipped or not. Please use this function
at the beginning of each new test file.

** `wiki_getpage`:
Fetch a given page from the wiki and puts its content in the
directory in parameter.

** `wiki_delete_page`:
Delete a given page from the wiki.

** `wiki_edit_page`:
Create or modify a given page in the wiki. You can specify several
parameters like a summary for the page edition, or add the page to a
given category.
See test-gitmw.pl for more details.

** `wiki_getallpage`:
Fetch all pages from the wiki into a given directory. The directory
is created if it does not exists.

** `test_diff_directories`:
Compare the content of two directories. The content must be the same.
Use this function to compare the content of a git directory and a wiki
one created by wiki_getallpage.

** `test_contains_N_files`:
Check if the given directory contains a given number of file.

** `wiki_page_exists`:
Tests if a given page exists on the wiki.

** `wiki_reset`:
Reset the wiki, i.e. flush the database. Use this function at the
beginning of each new test, except if the test re-uses the same wiki
(and history) as the previous test.

How to write a new test
~~~~~~~~~~~~~~~~~~~~~~~

Please, follow the standards given by git. See git/t/README.
New file should be named as t936[0-9]-*.sh.
Be sure to reset your wiki regulary with the function `wiki_reset`.