git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] perf: export some important test-lib variables

From
Thomas Rast <trast@student.ethz.ch>
Date
Mar 8, 2012, 08:54 UTC
Message-ID
<1c5b174027fc70f084a6547352596d8c0305f6c9.1331196679.git.trast@student.ethz.ch>
In-Reply-To
<14709b4345420da36a9152904bef4cc4503f78e4.1331196679.git.trast@student.ethz.ch>

The only bug right now is that $GIT_TEST_CMP is needed for test_cmp to work.

However, we also export the three most important paths for tests:
  TEST_DIRECTORY
  TRASH_DIRECTORY
  GIT_BUILD_DIR

Since they are available within test_expect_success, a future test writer may expect them to also be defined in test_perf.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 t/perf/p0000-perf-lib-sanity.sh |   11 ++++++++++-
 t/perf/perf-lib.sh              |    4 ++++
 2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/t/perf/p0000-perf-lib-sanity.sh b/t/perf/p0000-perf-lib-sanity.sh
index f8dd536..cf8e1ef 100755
--- a/t/perf/p0000-perf-lib-sanity.sh
+++ b/t/perf/p0000-perf-lib-sanity.sh
@@ -38,9 +38,18 @@ test_expect_success 'test_export works with weird vars' '
 	test "$bar" = "weird # variable"
 '
 
+test_perf 'important variables available in subshells' '
+	test -n "$HOME" &&
+	test -n "$TEST_DIRECTORY" &&
+	test -n "$TRASH_DIRECTORY" &&
+	test -n "$GIT_BUILD_DIR"
+'
+
 test_perf 'test-lib-functions correctly loaded in subshells' '
 	: >a &&
-	test_path_is_file a
+	test_path_is_file a &&
+	: >b &&
+	test_cmp a b
 '
 
 test_done
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index bcc0131..5580c22 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -45,6 +45,10 @@ TEST_NO_CREATE_REPO=t
 
 . ../test-lib.sh
 
+# Variables from test-lib that are normally internal to the tests; we
+# need to export them for test_perf subshells
+export TEST_DIRECTORY TRASH_DIRECTORY GIT_BUILD_DIR GIT_TEST_CMP
+
 perf_results_dir=$TEST_OUTPUT_DIRECTORY/test-results
 mkdir -p "$perf_results_dir"
 rm -f "$perf_results_dir"/$(basename "$0" .sh).subtests
-- 
1.7.9.3.556.g7eb2d
Previous: Thomas RastNext: Ramkumar Ramachandra
Message 8 of 22 in “[ANNOUNCE] Git 1.7.10-rc0”
  1. Junio C HamanoMar 8, 2012
  2. Jeff KingMar 8, 2012
  3. Junio C HamanoMar 8, 2012
  4. Junio C HamanoMar 8, 2012
  5. Jeff KingMar 8, 2012
  6. Junio C HamanoMar 8, 2012
  7. 1/2 perf: load test-lib-functions from the correct directoryThomas Rast, Mar 8, 2012
  8. 2/2 perf: export some important test-lib variablesThomas Rast, Mar 8, 2012
  9. Ramkumar RamachandraSep 17, 2012
  10. Thomas RastMar 8, 2012
  11. Nguyen Thai Ngoc DuyMar 8, 2012
  12. Junio C HamanoMar 8, 2012
  13. Jakub NarebskiMar 8, 2012
  14. Junio C HamanoMar 8, 2012
  15. Jakub NarebskiMar 8, 2012
  16. Junio C HamanoMar 8, 2012
  17. Tim HeniganMar 8, 2012
  18. Junio C HamanoMar 8, 2012
  19. RelNotes: noted the addition of contrib/diffallTim Henigan, Mar 9, 2012
  20. Junio C HamanoMar 9, 2012
  21. Tim HeniganMar 9, 2012
  22. Marc BranchaudMar 8, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.