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

Re: [PATCH v2 1/2] test-online-cpus: helper to return cpu count

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Apr 4, 2017, 16:38 UTC
Message-ID
<45b6c815-bae4-e33e-f4d6-172fdc7de7e2@ramsayjones.plus.com>
In-Reply-To
<20170403151642.2889-2-git@jeffhostetler.com>
On 03/04/17 16:16, git@jeffhostetler.com wrote:
Show 52 quoted lines
> From: Jeff Hostetler <jeffhost@microsoft.com>
> 
> Created helper executable to print the value of online_cpus()
> allowing multi-threaded tests to be skipped when appropriate.
> 
> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
> ---
>  Makefile                    | 1 +
>  t/helper/.gitignore         | 1 +
>  t/helper/test-online-cpus.c | 8 ++++++++
>  3 files changed, 10 insertions(+)
>  create mode 100644 t/helper/test-online-cpus.c
> 
> diff --git a/Makefile b/Makefile
> index 9b36068..3bb31e9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -626,6 +626,7 @@ TEST_PROGRAMS_NEED_X += test-line-buffer
>  TEST_PROGRAMS_NEED_X += test-match-trees
>  TEST_PROGRAMS_NEED_X += test-mergesort
>  TEST_PROGRAMS_NEED_X += test-mktemp
> +TEST_PROGRAMS_NEED_X += test-online-cpus
>  TEST_PROGRAMS_NEED_X += test-parse-options
>  TEST_PROGRAMS_NEED_X += test-path-utils
>  TEST_PROGRAMS_NEED_X += test-prio-queue
> diff --git a/t/helper/.gitignore b/t/helper/.gitignore
> index 758ed2e..b05d67c 100644
> --- a/t/helper/.gitignore
> +++ b/t/helper/.gitignore
> @@ -16,6 +16,7 @@
>  /test-match-trees
>  /test-mergesort
>  /test-mktemp
> +/test-online-cpus
>  /test-parse-options
>  /test-path-utils
>  /test-prio-queue
> diff --git a/t/helper/test-online-cpus.c b/t/helper/test-online-cpus.c
> new file mode 100644
> index 0000000..c881073
> --- /dev/null
> +++ b/t/helper/test-online-cpus.c
> @@ -0,0 +1,8 @@
> +#include "stdio.h"
> +#include "thread-utils.h"
> +
> +int cmd_main(int argc, const char **argv)
> +{
> +	printf("%d\n", online_cpus());
> +	return 0;
> +}
> 

In order to suppress a warning (for lack of extern declaration of cmd_main), we need to include git-compat-util.h ( or cache.h etc,.), like so:

  $ git diff
  diff --git a/t/helper/test-online-cpus.c b/t/helper/test-online-cpus.c
  index c88107360..b5277fb50 100644
  --- a/t/helper/test-online-cpus.c
  +++ b/t/helper/test-online-cpus.c
  @@ -1,3 +1,4 @@
  +#include "git-compat-util.h"
   #include "stdio.h"
   #include "thread-utils.h"
 
  $ 
Otherwise, this series fixes the test for me.
Thanks!

ATB, Ramsay Jones

Previous: git@jeffhostetler.comNext: git@jeffhostetler.com
Message 3 of 5 in “name-hash: fix buffer overrun”
  1. 0/2 name-hash: fix buffer overrungit@jeffhostetler.com, Apr 3, 2017
  2. 1/2 test-online-cpus: helper to return cpu countgit@jeffhostetler.com, Apr 3, 2017
  3. Ramsay JonesApr 4, 2017
  4. 2/2 name-hash: fix buffer overrungit@jeffhostetler.com, Apr 3, 2017
  5. Junio C HamanoApr 13, 2017

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.