Conversation
include/asdf/core/time.h
Outdated
| ASDF_TIME_FORMAT_PLOT_DATE, | ||
| ASDF_TIME_FORMAT_YMDHMS, | ||
| ASDF_TIME_FORMAT_datetime64, | ||
| } asdf_time_base_format; |
There was a problem hiding this comment.
I like to add the _t suffix even with type-def'd enums. But I don't have a strict rule about this. Just mentioning it but I won't nitpick over it beyond that ;)
| struct asdf_time_info_t { | ||
| struct timespec ts; | ||
| struct tm tm; | ||
| }; |
There was a problem hiding this comment.
Ah, but then don't use the _t suffix for anything that isn't typedef'd; then it's hard to remember it needs struct :)
src/core/time.c
Outdated
| const int HOURS_PER_DAY = 24; | ||
| const int SECONDS_PER_DAY = 86400; | ||
| const int SECONDS_PER_HOUR = 3600; | ||
| const int SECONDS_PER_MINUTE = 60; |
There was a problem hiding this comment.
More stuff should be static around here.
tests/test-time.c
Outdated
| "t_jd", | ||
| "t_mjd", | ||
| "t_byear", | ||
| }; |
There was a problem hiding this comment.
If you want you can also write parametrized tests with μnit. Not so important here but you can see an example in test-ndarray.c for example (test_numeric_conversion_params).
tests/test-time.c
Outdated
|
|
||
| value = asdf_get_value(file, key); | ||
| if (asdf_value_as_time(value, &t) != ASDF_VALUE_OK) { | ||
| fprintf(stderr, "asdf_value_as_time failed: %s\n", key); |
There was a problem hiding this comment.
Oh yeah, you can use
munit_logf("asdf_value_as_time failed: %s\n", key);for this and other print calls in the tests. And below this you can return MUNIT_FAIL
Implement the asdf/core/time-1.4.0 schema as an extension, supporting deserialization and serialization of time values from/to ASDF files. The extension handles these time formats: ISO 8601, ordinal (yday), Unix epoch, Julian Date, Modified Julian Date, and Besselian year, with optional time scale and observer location.
Replace mkstemp-based temp file paths (random names scattered in TEMP_DIR) with per-run numbered subdirectories (TEMP_DIR/000001/, 000002/, ...). All test binaries that share a process group (i.e. all binaries launched by a single `make check` invocation) land in the same subdirectory via a PGID coordination file (TEMP_DIR/.pgid-<PGID>). The first binary to start is "pioneer" (wins an O_CREAT|O_EXCL race on the coordination file) and creates the run directory; subsequent binaries are "followers" that read the serial from the coordination file and join the same directory. Coordination files are cleaned up lazily: on startup each binary removes files whose process group is no longer alive (kill(-pgid, 0) == ESRCH). Empty run directories are reclaimed on exit via a destructor that calls rmdir (no-op if non-empty). The pioneer also reuses the most recent run directory if it is empty, so clean runs do not accumulate directories. A "latest" symlink points to the most recently started run for convenience. test: fix get_total_memory call in parse util tests
|
Finally got around to coming back to this. Fixed a few of my review comments and rebased on main, adding serialization support in the process. While working on this was also motivated to revive a stashed experimental improvement to the test infrastructure for outputting temp files produced by tests. I like this much better now. |
init_run_dir into cleaner subroutines
test: use TEST_SERIAL_FMT macro in more places where it's relevant
No description provided.