Thread overview
make std/algorithm/comparison.test should only test that module
Sep 16, 2020
Sebastian Wilzbach
September 15, 2020
Hi, per posix.mak:

# make std/somemodule.test => only builds and unittests std.somemodule

I just tried:

make std/algorithm/comparison.test

and it seems to build and run all tests. Before I look into it closer, any known change that affected this? Thanks.
September 16, 2020
Hi Andrei,

Are you confusing _building_ the standard library with _testing_ it? This is what happens on my machine [1] with master:

---
~/dlang/phobos on master ± touch std/algorithm/comparison.d

~/dlang/phobos on master ± pmake std/algorithm/comparison.test
make -C ../druntime -f posix.mak MODEL=64
DMD=../dmd/generated/linux/release/64/dmd OS=linux BUILD=release
make[1]: Entering directory '/home/seb/dlang/druntime'
make[1]: Nothing to be done for 'target'.
make[1]: Leaving directory '/home/seb/dlang/druntime'
../dmd/generated/linux/release/64/dmd -conf= -I../druntime/import  -w
-de -preview=dip1000 -preview=dtorfields -m64 -fPIC -transition=complex
-O -release -lib -ofgenerated/linux/release/64/libphobos2.a
../druntime/generated/linux/release/64/libdruntime.a std/array.d
std/ascii.d std/base64.d std/bigint.d std/bitmanip.d std/compiler.d
std/complex.d std/concurrency.d std/conv.d std/csv.d std/demangle.d
std/encoding.d std/exception.d std/file.d std/format.d std/functional.d
std/getopt.d std/json.d std/math.d std/mathspecial.d std/meta.d
std/mmfile.d std/numeric.d std/outbuffer.d std/package.d
std/parallelism.d std/path.d std/process.d std/random.d std/signals.d
std/socket.d std/stdint.d std/stdio.d std/string.d std/system.d
std/traits.d std/typecons.d std/uri.d std/utf.d std/uuid.d std/variant.d
std/xml.d std/zip.d std/zlib.d std/algorithm/comparison.d
std/algorithm/iteration.d std/algorithm/mutation.d
std/algorithm/package.d std/algorithm/searching.d std/algorithm/setops.d
std/algorithm/sorting.d std/container/array.d std/container/binaryheap.d
std/container/dlist.d std/container/package.d std/container/rbtree.d
std/container/slist.d std/container/util.d std/datetime/date.d
std/datetime/interval.d std/datetime/package.d std/datetime/stopwatch.d
std/datetime/systime.d std/datetime/timezone.d std/digest/crc.d
std/digest/hmac.d std/digest/md.d std/digest/murmurhash.d
std/digest/package.d std/digest/ripemd.d std/digest/sha.d
std/experimental/allocator/common.d
std/experimental/allocator/gc_allocator.d
std/experimental/allocator/mallocator.d
std/experimental/allocator/mmap_allocator.d
std/experimental/allocator/package.d
std/experimental/allocator/showcase.d std/experimental/allocator/typed.d
std/experimental/allocator/building_blocks/affix_allocator.d
std/experimental/allocator/building_blocks/aligned_block_list.d
std/experimental/allocator/building_blocks/allocator_list.d
std/experimental/allocator/building_blocks/ascending_page_allocator.d
std/experimental/allocator/building_blocks/bucketizer.d
std/experimental/allocator/building_blocks/fallback_allocator.d
std/experimental/allocator/building_blocks/free_list.d
std/experimental/allocator/building_blocks/free_tree.d
std/experimental/allocator/building_blocks/bitmapped_block.d
std/experimental/allocator/building_blocks/kernighan_ritchie.d
std/experimental/allocator/building_blocks/null_allocator.d
std/experimental/allocator/building_blocks/package.d
std/experimental/allocator/building_blocks/quantizer.d
std/experimental/allocator/building_blocks/region.d
std/experimental/allocator/building_blocks/scoped_allocator.d
std/experimental/allocator/building_blocks/segregator.d
std/experimental/allocator/building_blocks/stats_collector.d
std/experimental/logger/core.d std/experimental/logger/filelogger.d
std/experimental/logger/nulllogger.d
std/experimental/logger/multilogger.d std/experimental/logger/package.d
std/net/curl.d std/net/isemail.d std/uni/package.d
std/experimental/checkedint.d std/experimental/typecons.d
std/range/interfaces.d std/range/package.d std/range/primitives.d
std/regex/package.d std/regex/internal/generator.d
std/regex/internal/ir.d std/regex/internal/parser.d
std/regex/internal/backtracking.d std/regex/internal/tests.d
std/regex/internal/tests2.d std/regex/internal/thompson.d
std/regex/internal/kickstart.d std/windows/charset.d
std/windows/registry.d std/windows/syserror.d etc/c/curl.d
etc/c/odbc/sql.d etc/c/odbc/sqlext.d etc/c/odbc/sqltypes.d
etc/c/odbc/sqlucode.d etc/c/sqlite3.d etc/c/zlib.d
std/algorithm/internal.d std/digest/digest.d std/internal/cstring.d
std/internal/digest/sha_SSSE3.d std/internal/math/biguintcore.d
std/internal/math/biguintnoasm.d std/internal/math/biguintx86.d
std/internal/math/errorfunction.d std/internal/math/gammafunction.d
std/internal/scopebuffer.d std/internal/test/dummyrange.d
std/internal/test/range.d std/internal/unicode_comp.d
std/internal/unicode_decomp.d std/internal/unicode_grapheme.d
std/internal/unicode_norm.d std/internal/unicode_tables.d
std/internal/windows/advapi32.d std/typetuple.d
generated/linux/release/64/etc/c/zlib/adler32.o
generated/linux/release/64/etc/c/zlib/compress.o
generated/linux/release/64/etc/c/zlib/crc32.o
generated/linux/release/64/etc/c/zlib/deflate.o
generated/linux/release/64/etc/c/zlib/gzclose.o
generated/linux/release/64/etc/c/zlib/gzlib.o
generated/linux/release/64/etc/c/zlib/gzread.o
generated/linux/release/64/etc/c/zlib/gzwrite.o
generated/linux/release/64/etc/c/zlib/infback.o
generated/linux/release/64/etc/c/zlib/inffast.o
generated/linux/release/64/etc/c/zlib/inflate.o
generated/linux/release/64/etc/c/zlib/inftrees.o
generated/linux/release/64/etc/c/zlib/trees.o
generated/linux/release/64/etc/c/zlib/uncompr.o
generated/linux/release/64/etc/c/zlib/zutil.o
T=`mktemp -d /tmp/.dmd-run-test.XXXXXX` &&
                                \
  (
                                \
    ../dmd/generated/linux/release/64/dmd -od$T -conf=
-I../druntime/import  -w -de -preview=dip1000 -preview=dtorfields -m64
-fPIC -transition=complex -O -release -main -unittest
-version=StdUnittest generated/linux/release/64/libphobos2.a
-defaultlib= -debuglib= -L-lpthread -L-lm -L-ldl -cov=ctfe -run
std/algorithm/comparison.d ;     \
    RET=$? ; rm -rf $T ; exit $RET
                             \
  )
1 modules passed unittests
make -f posix.mak std/algorithm/comparison.test  12,68s user 0,98s
system 99% cpu 13,722 total
---

Note that we only run unittests of std/algorithm/comparison.d, but need to build Phobos. If you don't change any other parts of Phobos, you can typically get away with

dmd -unittest -main -run std/algorithm/comparison.d

Though while it sometimes might work with the latest relase, on my system I get linker errors as things have changed:

---
comparison.o:std/algorithm/comparison.d:function
_D3std4math__T11approxEqualTdTdTdZQuFNaNbNiNfddddZb: error: undefined
reference to '_D3std4math4fabsFNaNbNiNedZd'
comparison.o:std/algorithm/comparison.d:function
_D3std4math__T11approxEqualTdTdTdZQuFNaNbNiNfddddZb: error: undefined
reference to '_D3std4math4fabsFNaNbNiNedZd'
comparison.o:std/algorithm/comparison.d:function
_D3std4math__T11approxEqualTdTdTdZQuFNaNbNiNfddddZb: error: undefined
reference to '_D3std4math4fabsFNaNbNiNedZd'
collect2: error: ld returned 1 exit status
---

So you'll need to make sure to use the latest DMD which by default includes your freshly built Phobos library. Then you don't need to rebuild Phobos constantly.

Cheers,

Seb

[1] `alias pmake = make -f posix.mak`

On 15/09/2020 18.13, Andrei Alexandrescu via Dlang-internal wrote:
> Hi, per posix.mak:
> 
> # make std/somemodule.test => only builds and unittests std.somemodule
> 
> I just tried:
> 
> make std/algorithm/comparison.test
> 
> and it seems to build and run all tests. Before I look into it closer, any known change that affected this? Thanks.
September 17, 2020
Thanks. Indeed, actually I noticed just now that this happens only on OSX. On Linux things work as expected.

E.g. on OSX (I won't paste the entire log) make prints this while building std/algorithm/comparison.test:

../dmd/generated/osx/release/64/dmd  -conf= -I../druntime/import  -w -de -preview=dip1000 -preview=dtorfields -m64 -fPIC -transition=complex -O -release -unittest -version=StdUnittest -c -ofgenerated/osx/release/64/unittest/std/bitmanip.o std/bitmanip.d

And so on for all other modules. These lines don't appear on Linux.


On 9/15/20 8:59 PM, Sebastian Wilzbach wrote:
> Hi Andrei,
> 
> Are you confusing _building_ the standard library with _testing_ it?
> This is what happens on my machine [1] with master:
> 
> ---
> ~/dlang/phobos on master ± touch std/algorithm/comparison.d
> 
> ~/dlang/phobos on master ± pmake std/algorithm/comparison.test
> make -C ../druntime -f posix.mak MODEL=64
> DMD=../dmd/generated/linux/release/64/dmd OS=linux BUILD=release
> make[1]: Entering directory '/home/seb/dlang/druntime'
> make[1]: Nothing to be done for 'target'.
> make[1]: Leaving directory '/home/seb/dlang/druntime'
> ../dmd/generated/linux/release/64/dmd -conf= -I../druntime/import  -w
> -de -preview=dip1000 -preview=dtorfields -m64 -fPIC -transition=complex
> -O -release -lib -ofgenerated/linux/release/64/libphobos2.a
> ../druntime/generated/linux/release/64/libdruntime.a std/array.d
> std/ascii.d std/base64.d std/bigint.d std/bitmanip.d std/compiler.d
> std/complex.d std/concurrency.d std/conv.d std/csv.d std/demangle.d
> std/encoding.d std/exception.d std/file.d std/format.d std/functional.d
> std/getopt.d std/json.d std/math.d std/mathspecial.d std/meta.d
> std/mmfile.d std/numeric.d std/outbuffer.d std/package.d
> std/parallelism.d std/path.d std/process.d std/random.d std/signals.d
> std/socket.d std/stdint.d std/stdio.d std/string.d std/system.d
> std/traits.d std/typecons.d std/uri.d std/utf.d std/uuid.d std/variant.d
> std/xml.d std/zip.d std/zlib.d std/algorithm/comparison.d
> std/algorithm/iteration.d std/algorithm/mutation.d
> std/algorithm/package.d std/algorithm/searching.d std/algorithm/setops.d
> std/algorithm/sorting.d std/container/array.d std/container/binaryheap.d
> std/container/dlist.d std/container/package.d std/container/rbtree.d
> std/container/slist.d std/container/util.d std/datetime/date.d
> std/datetime/interval.d std/datetime/package.d std/datetime/stopwatch.d
> std/datetime/systime.d std/datetime/timezone.d std/digest/crc.d
> std/digest/hmac.d std/digest/md.d std/digest/murmurhash.d
> std/digest/package.d std/digest/ripemd.d std/digest/sha.d
> std/experimental/allocator/common.d
> std/experimental/allocator/gc_allocator.d
> std/experimental/allocator/mallocator.d
> std/experimental/allocator/mmap_allocator.d
> std/experimental/allocator/package.d
> std/experimental/allocator/showcase.d std/experimental/allocator/typed.d
> std/experimental/allocator/building_blocks/affix_allocator.d
> std/experimental/allocator/building_blocks/aligned_block_list.d
> std/experimental/allocator/building_blocks/allocator_list.d
> std/experimental/allocator/building_blocks/ascending_page_allocator.d
> std/experimental/allocator/building_blocks/bucketizer.d
> std/experimental/allocator/building_blocks/fallback_allocator.d
> std/experimental/allocator/building_blocks/free_list.d
> std/experimental/allocator/building_blocks/free_tree.d
> std/experimental/allocator/building_blocks/bitmapped_block.d
> std/experimental/allocator/building_blocks/kernighan_ritchie.d
> std/experimental/allocator/building_blocks/null_allocator.d
> std/experimental/allocator/building_blocks/package.d
> std/experimental/allocator/building_blocks/quantizer.d
> std/experimental/allocator/building_blocks/region.d
> std/experimental/allocator/building_blocks/scoped_allocator.d
> std/experimental/allocator/building_blocks/segregator.d
> std/experimental/allocator/building_blocks/stats_collector.d
> std/experimental/logger/core.d std/experimental/logger/filelogger.d
> std/experimental/logger/nulllogger.d
> std/experimental/logger/multilogger.d std/experimental/logger/package.d
> std/net/curl.d std/net/isemail.d std/uni/package.d
> std/experimental/checkedint.d std/experimental/typecons.d
> std/range/interfaces.d std/range/package.d std/range/primitives.d
> std/regex/package.d std/regex/internal/generator.d
> std/regex/internal/ir.d std/regex/internal/parser.d
> std/regex/internal/backtracking.d std/regex/internal/tests.d
> std/regex/internal/tests2.d std/regex/internal/thompson.d
> std/regex/internal/kickstart.d std/windows/charset.d
> std/windows/registry.d std/windows/syserror.d etc/c/curl.d
> etc/c/odbc/sql.d etc/c/odbc/sqlext.d etc/c/odbc/sqltypes.d
> etc/c/odbc/sqlucode.d etc/c/sqlite3.d etc/c/zlib.d
> std/algorithm/internal.d std/digest/digest.d std/internal/cstring.d
> std/internal/digest/sha_SSSE3.d std/internal/math/biguintcore.d
> std/internal/math/biguintnoasm.d std/internal/math/biguintx86.d
> std/internal/math/errorfunction.d std/internal/math/gammafunction.d
> std/internal/scopebuffer.d std/internal/test/dummyrange.d
> std/internal/test/range.d std/internal/unicode_comp.d
> std/internal/unicode_decomp.d std/internal/unicode_grapheme.d
> std/internal/unicode_norm.d std/internal/unicode_tables.d
> std/internal/windows/advapi32.d std/typetuple.d
> generated/linux/release/64/etc/c/zlib/adler32.o
> generated/linux/release/64/etc/c/zlib/compress.o
> generated/linux/release/64/etc/c/zlib/crc32.o
> generated/linux/release/64/etc/c/zlib/deflate.o
> generated/linux/release/64/etc/c/zlib/gzclose.o
> generated/linux/release/64/etc/c/zlib/gzlib.o
> generated/linux/release/64/etc/c/zlib/gzread.o
> generated/linux/release/64/etc/c/zlib/gzwrite.o
> generated/linux/release/64/etc/c/zlib/infback.o
> generated/linux/release/64/etc/c/zlib/inffast.o
> generated/linux/release/64/etc/c/zlib/inflate.o
> generated/linux/release/64/etc/c/zlib/inftrees.o
> generated/linux/release/64/etc/c/zlib/trees.o
> generated/linux/release/64/etc/c/zlib/uncompr.o
> generated/linux/release/64/etc/c/zlib/zutil.o
> T=`mktemp -d /tmp/.dmd-run-test.XXXXXX` &&
>                                  \
>    (
>                                  \
>      ../dmd/generated/linux/release/64/dmd -od$T -conf=
> -I../druntime/import  -w -de -preview=dip1000 -preview=dtorfields -m64
> -fPIC -transition=complex -O -release -main -unittest
> -version=StdUnittest generated/linux/release/64/libphobos2.a
> -defaultlib= -debuglib= -L-lpthread -L-lm -L-ldl -cov=ctfe -run
> std/algorithm/comparison.d ;     \
>      RET=$? ; rm -rf $T ; exit $RET
>                               \
>    )
> 1 modules passed unittests
> make -f posix.mak std/algorithm/comparison.test  12,68s user 0,98s
> system 99% cpu 13,722 total
> ---
> 
> Note that we only run unittests of std/algorithm/comparison.d, but need
> to build Phobos. If you don't change any other parts of Phobos, you can
> typically get away with
> 
> dmd -unittest -main -run std/algorithm/comparison.d
> 
> Though while it sometimes might work with the latest relase, on my
> system I get linker errors as things have changed:
> 
> ---
> comparison.o:std/algorithm/comparison.d:function
> _D3std4math__T11approxEqualTdTdTdZQuFNaNbNiNfddddZb: error: undefined
> reference to '_D3std4math4fabsFNaNbNiNedZd'
> comparison.o:std/algorithm/comparison.d:function
> _D3std4math__T11approxEqualTdTdTdZQuFNaNbNiNfddddZb: error: undefined
> reference to '_D3std4math4fabsFNaNbNiNedZd'
> comparison.o:std/algorithm/comparison.d:function
> _D3std4math__T11approxEqualTdTdTdZQuFNaNbNiNfddddZb: error: undefined
> reference to '_D3std4math4fabsFNaNbNiNedZd'
> collect2: error: ld returned 1 exit status
> ---
> 
> So you'll need to make sure to use the latest DMD which by default
> includes your freshly built Phobos library. Then you don't need to
> rebuild Phobos constantly.
> 
> Cheers,
> 
> Seb
> 
> [1] `alias pmake = make -f posix.mak`
> 
> On 15/09/2020 18.13, Andrei Alexandrescu via Dlang-internal wrote:
>> Hi, per posix.mak:
>>
>> # make std/somemodule.test => only builds and unittests std.somemodule
>>
>> I just tried:
>>
>> make std/algorithm/comparison.test
>>
>> and it seems to build and run all tests. Before I look into it closer,
>> any known change that affected this? Thanks.

September 28, 2020
On 9/17/20 9:59 AM, Andrei Alexandrescu wrote:
> Thanks. Indeed, actually I noticed just now that this happens only on OSX. On Linux things work as expected.
> 
> E.g. on OSX (I won't paste the entire log) make prints this while building std/algorithm/comparison.test:
> 
> ../dmd/generated/osx/release/64/dmd  -conf= -I../druntime/import  -w -de -preview=dip1000 -preview=dtorfields -m64 -fPIC -transition=complex -O -release -unittest -version=StdUnittest -c -ofgenerated/osx/release/64/unittest/std/bitmanip.o std/bitmanip.d
> 
> And so on for all other modules. These lines don't appear on Linux.

Update: it was a scripting error on my side - things work fine on OSX, too.