2 Add working code
source | link

Your ${group_number} will be replaced by the make macro with that name. But the line above it sets it as a shell variable (in a different shell than the one you're using it in; simply doubling the $ will not work).

You should define it as a macro -- ie not in a rule, in a non tab indented line:

group_number = ....

. Same thing with tests; each line is run in a different shell, you cannot share variables between them.

Working solution:

foo: group_number=$(shell echo $$(( $(test_group) - 1 )))
foo: tests=$(shell ls *.feature | awk 'NR%$(test_group_count)==${group_number}')
foo:
    run_tests ${tests}

Your ${group_number} will be replaced by the make macro with that name. But the line above it sets it as a shell variable (in a different shell than the one you're using it in; simply doubling the $ will not work).

You should define it as a macro -- ie not in a rule, in a non tab indented line:

group_number = ....

Same thing with tests; each line is run in a different shell, you cannot share variables between them.

Your ${group_number} will be replaced by the make macro with that name. But the line above it sets it as a shell variable (in a different shell than the one you're using it in; simply doubling the $ will not work).

You should define it as a macro -- ie not in a rule, in a non tab indented line. Same thing with tests; each line is run in a different shell, you cannot share variables between them.

Working solution:

foo: group_number=$(shell echo $$(( $(test_group) - 1 )))
foo: tests=$(shell ls *.feature | awk 'NR%$(test_group_count)==${group_number}')
foo:
    run_tests ${tests}
1
source | link

Your ${group_number} will be replaced by the make macro with that name. But the line above it sets it as a shell variable (in a different shell than the one you're using it in; simply doubling the $ will not work).

You should define it as a macro -- ie not in a rule, in a non tab indented line:

group_number = ....

Same thing with tests; each line is run in a different shell, you cannot share variables between them.

    Post Made Community Wiki by pizdelect