Commit graph

118 commits

Author SHA1 Message Date
Dustin J. Mitchell
a701f8fc7d
Open Replica read-only when possible (#3776)
* Open Replica read-only when possible

Specifically, when either
 - the command is read-only; or
 - the command requires GC (including recurrence updates) but GC is disabled by config

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-02-14 10:25:19 +01:00
Dustin J. Mitchell
fdb7e5e020
Test for unusual task data (#3770)
* Test for unusual task data

A task might have any combination of keys and values, but Taskwarrior
often assumes that only valid values can occur, and crashes otherwise.
This is highly inconvenient, as it's often impossible to do anything
with the invalid task -- Taskwarrior just fails without modifying it.

So, this is the beginning of some testing for such invalid tasks, with
the goal of making Taskwarrior due something reasonable. In general, an
invalid attribute value is treated as if it was not set. This is not
exhaustive, and there are likely still bugs of this sort, but as we find
them we can fix and add regression tests to this script.

This introduces a new test-only binary that creates a "bare" task using
TaskChampion, avoiding Taskwarrior's efforts to not create "unusual"
tasks.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-02-05 08:20:35 -05:00
Dustin J. Mitchell
cc505e4881
Support importing Taskwarrior v2.x data files (#3724)
This should ease the pain of upgrading from v2.x to v3.x.
2024-12-17 01:24:45 +00:00
Dustin J. Mitchell
c9967c20e2
Restore support for task info journal (#3671)
This support was removed before Taskwarrior-3.x, and is now restored,
including the original tests removed in
ddd367232e
2024-11-06 07:39:39 -05:00
Dustin J. Mitchell
c719cce4f1
Run all C++ tests from a single executable (#3582) 2024-08-12 00:20:17 +00:00
Dustin J. Mitchell
4ff63a7960
Use TaskChampion 0.7.0, now via cxx instead of hand-rolled FFI (#3588)
TC 0.7.0 introduces a new `TaskData` type that maps to Taskwarrior's
`Task` type more cleanly. It also introduces the idea of gathering lists
of operations and "committing" them to a replica.

A consequence of this change is that TaskChampion no longer
automatically maintains dependency information, so Taskwarrior must do
so, with its `TDB2::dependency_sync` method. This method does a very
similar thing to what TaskChampion had been doing, so this is a shift of
responsibility but not a major performance difference.

Cxx is .. not great. It is missing a lot of useful things that make a
general-purpose bridge impractical:

 - no support for trait objects
 - no support for `Option<T>` (https://github.com/dtolnay/cxx/issues/87)
 - no support for `Vec<Box<..>>`

As a result, some creativity is required in writing the bridge, for
example returning a `Vec<OptionTaskData>` from `all_task_data` to allow
individual `TaskData` values to be "taken" from the vector.

That said, Cxx is the current state-of-the-art, and does a good job of
ensuring memory safety, at the cost of some slightly awkward APIs.

Subsequent work can remove the "TDB2" layer and allow commands and other
parts of Taskwarrior to interface directly with the `Replica`.
2024-08-11 02:06:00 +00:00
Dustin J. Mitchell
17889a3f25
Actually run shell tests (#3583)
Two of these used EXPFAIL which, because nothing is interpreting the TAP
output, does not work. So, that functionality is removed, and the
expected-to-fail bits are commented out or removed.

There was a conditional on the filename in `bash_tap.sh` which caused it
to not actually do anything and just run the test as a simple shell
script. That, too, has been removed.
2024-08-07 00:44:12 +00:00
Adrian Sadłocha
9c49863795
Make task news nag configurable and deterministic (#3567)
This patch fixes #3497.
2024-07-26 20:30:54 -04:00
Dustin J. Mitchell
7d79b9e516
Rename 'expiration.on-sync' to 'purge.on-sync' (#3556)
Taskwarrior uses "expire" to refer to deletion of tasks past their
"until" date, so let's use `purge` to link this semantically to the
`task purge` command.
2024-07-14 15:45:26 -04:00
Dustin J. Mitchell
1304d6361c
Restore 'task purge' functionality (#3540)
Co-authored-by: ryneeverett <ryneeverett@gmail.com>
2024-07-14 15:59:00 +00:00
Dustin J. Mitchell
213b9d3aee
Add support for task expiration (#3546) 2024-07-09 16:39:39 -04:00
Will R S Hansen
2bd609afe3
Export tasks in a deterministic order (#3549)
fix issue #3527
2024-07-09 03:22:14 +00:00
Felix Schurk
82e0d53cdf
add ctest as test driver (#3446) 2024-05-10 01:20:54 +00:00
Dustin J. Mitchell
8aa4758993
add targets for individual tests (#3431) 2024-05-03 10:06:29 -04:00
Dustin J. Mitchell
94b3e301d1
Remove taskchampion source from this repo (#3427)
* move taskchampion-lib to src/tc/lib, remove the rest
* update references to taskchampion
* Use a top-level Cargo.toml so everything is consistent
* apply comments from ryneeverett
2024-05-02 02:45:11 +00:00
mattsmida
ef9613e2d6
Renaming test files according to their language (#3407) 2024-05-01 14:28:07 -04:00
Felix Schurk
d093ce3d84
Fix test script paths (#3387)
* fix path to task executable in pyton tests

The current approach would copy the current files into the `build/test`
directory. Updating the paths according to the custom user setup.

By the copy I appended `.py` to have a clear visible distingtion which
ones are the python tests.

As soon as a source file in the normal directory is changed, it is
copied over and the corresponding file is updated.

From now on the python tests would need to get run in the according
build directory.

* reflect the current build instruction in PR template

* update paths and globing in run_all

* add line break for every cpp test

* remove .gitignore in test folder

As now all the auxillary files such as `all.log` as well as the
executables are present in the `build` directory there is no longer a
need to ignore them.

* update paths in python test scripts and enable deactivated

* remove .py extension when copy to build

Further remove glob pattern for `*.t.py` tests.

* remove accidentally added template.t from test files
2024-04-28 15:38:14 -04:00
Dustin J. Mitchell
18a8bd2997
Use corrosion instead of CMakeRust (#3273)
* Use corrosion instead of CMakeRust
* use OpenSUSE tumbleweed (latest) to get newer CMake
2024-03-02 16:21:34 -05:00
Dustin J. Mitchell
9566c929e2
Add support for cloud sync, specifically GCP (#3223)
* Add support for cloud sync, specifically GCP

This adds generic support for sync to cloud services, with specific
spuport for GCP. Adding others -- so long as they support a
compare-and-set operation -- should be comparatively straightforward.

The cloud support includes cleanup of unnecessary data, and should keep
total space usage roughly proportional to the number of tasks.

Co-authored-by: ryneeverett <ryneeverett@gmail.com>
2024-01-21 12:36:37 -05:00
Dathan Bennett
a7bb0c9ba0
Link executables using system frameworks on Darwin (#3075)
* Link test executables using system frameworks on Darwin

On an M1 MBP, running `cmake . && make test` yields the error

```
[ 69%] Linking CXX executable tc.t
Undefined symbols for architecture arm64:
  "_CFRelease", referenced from:
      _$LT$iana_time_zone..platform..system_time_zone..SystemTimeZone$u20$as$u20$core..ops..drop..Drop$GT$::drop::hcd3964de9573de30 in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.15.rcgu.o)
  "_CFStringGetBytes", referenced from:
      iana_time_zone::platform::string_ref::StringRef$LT$T$GT$::to_utf8::h39971b546d587152 in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.13.rcgu.o)
  "_CFStringGetCStringPtr", referenced from:
      iana_time_zone::platform::string_ref::StringRef$LT$T$GT$::as_utf8::h8bb5c2c0d091ded1 in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.13.rcgu.o)
  "_CFStringGetLength", referenced from:
      iana_time_zone::platform::string_ref::StringRef$LT$T$GT$::to_utf8::h39971b546d587152 in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.13.rcgu.o)
  "_CFTimeZoneCopySystem", referenced from:
      iana_time_zone::platform::system_time_zone::SystemTimeZone:🆕:hc42d30609914d79d in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.15.rcgu.o)
  "_CFTimeZoneGetName", referenced from:
      iana_time_zone::platform::system_time_zone::SystemTimeZone::name::h44947ee6deb3339a in libtc_rust.a(iana_time_zone-0e2714c6ff24f5bb.iana_time_zone.4cacef0c-cgu.15.rcgu.o)
  "_SecRandomCopyBytes", referenced from:
      ring::rand::darwin::fill::h0ad94d66d4e1a222 in libtc_rust.a(ring-e5f87a2e334d4c6a.ring.a21bac31-cgu.4.rcgu.o)
  "_kSecRandomDefault", referenced from:
      ring::rand::darwin::fill::h0ad94d66d4e1a222 in libtc_rust.a(ring-e5f87a2e334d4c6a.ring.a21bac31-cgu.4.rcgu.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [test/tc.t] Error 1
make[2]: *** [test/CMakeFiles/tc.t.dir/all] Error 2
make[1]: *** [test/CMakeFiles/test.dir/rule] Error 2
```

This change resolves the error by updating the targets in
test/CMakeLists.txt to link against the CoreFoundation and Security
frameworks when building under Mac OS.

* Link executables against CoreFoundation and Security frameworks on Mac OS

* Rename test_osx.sh to test_macos.sh

---------

Co-authored-by: Dathan Bennett <dathanb@netflix.com>
2023-07-20 17:23:12 -04:00
Dustin J. Mitchell
5bb9857984 Use Taskchampion to store Taskwarrior data
This replaces the TF2 task files with a TaskChampion replica.
2023-06-11 17:37:03 -04:00
Dustin J. Mitchell
12ecfa2b1e rename rust/ to taskchampion/ 2022-07-29 21:41:41 -04:00
Dustin J. Mitchell
8c30400af3 Add a C++ wrapper around TC FFI
This uses CMake to build a simple Rust library (in `src/tc/rust`) that
just re-exports everything from the `taskchampion-lib` crate.

The C++ wrappers then wrap this into C++ objects with proper lifecycle
maintenance, in the `tc` namespace.

The C++ wrappers are incomplete, and missing methods are tagged with
"TODO".  These will be added as needed.
2022-07-29 21:41:41 -04:00
Dustin J. Mitchell
28e268bd26 fix parsing invalid depends from server
The data from the server is read via Task::parseJSON, not Task::parse.

This also reverts the tests for Task::parse, and adds new tests for this
specific issue.
2022-01-19 19:34:45 -05:00
Paul Beckingham
fb97883bef Build: Do not set CMP0037 on CMake 3.11.0 and above
- This policy is no longer necessary because CMake issue #16062, which caused
  incorrect warnings to be shown, has been resolved in 3.11.0.
- Thanks to Janik Rabe
2019-04-26 20:45:46 -04:00
Tomas Babej
a071694324 test: Workaround the cyclic dependencies between the libraries 2019-02-07 08:37:59 -05:00
Paul Beckingham
53088dae65 Build: C++14 support added 2018-05-14 00:53:32 -04:00
Paul Beckingham
d5a7769b4f Tests: Added first DOM test 2018-05-13 23:18:17 -04:00
Paul Beckingham
6009e20aa4 Tests: Named date tests migrated to libshared 2018-05-13 22:58:25 -04:00
Paul Beckingham
f2483538d2 Tests: Removed unused Nibbler tests 2018-05-13 22:54:58 -04:00
Paul Beckingham
c5f5b4a1f0 Tests: Eliminated ISO8601d tests 2018-05-13 22:53:10 -04:00
Paul Beckingham
c488e1d45c Tests: Eliminated ISO8601p tests 2018-05-13 22:52:31 -04:00
Paul Beckingham
b57a734625 Config: Migrated to libshared Configuration 2018-05-13 22:43:33 -04:00
Paul Beckingham
728390b6e5 Color: Now uses libshared 2018-05-13 22:22:41 -04:00
Paul Beckingham
c571f6b4fb Msg: Migrated to use libshared 2018-05-13 20:32:56 -04:00
Paul Beckingham
026a8aa9a1 Tests: Eliminated empty text.t test 2018-05-13 20:31:26 -04:00
Paul Beckingham
8462120c0a Tests: Removed migrated autoComplete tests 2018-05-13 20:29:14 -04:00
Paul Beckingham
555dc98f5b Tests: Removed redundant FS tests 2018-05-13 20:04:55 -04:00
Paul Beckingham
d0251642bc Tests: Removed redundant utf8 tests 2018-05-13 20:02:56 -04:00
Paul Beckingham
9a63bd5d6f Tests: Removed redundant listt tests 2018-05-13 20:02:03 -04:00
Paul Beckingham
a7900205e5 Tests: Removed redundant format tests 2018-05-13 20:01:45 -04:00
Paul Beckingham
dbb22f506d Tests: Removed JSON tests 2018-05-13 20:01:27 -04:00
Paul Beckingham
db182f4612 Tests: Removed RX tests 2018-05-13 19:59:09 -04:00
Paul Beckingham
4395818e72 CMake: Added snotty comment about CMake bullshit 2018-05-13 19:44:41 -04:00
Paul Beckingham
9b5c0c81a3 Build: Included 'problems' script in build dir
- Thanks to Gordon Ball.
2016-02-06 12:08:31 -05:00
Paul Beckingham
acca829aed Test: Merged t3.t.cpp into t.t.cpp 2015-10-23 10:19:17 -04:00
Paul Beckingham
bb58b796fd Task Data Parsing
- Improved the handling when parsing blank lines and empty task in the data, so
  that instead of the message:

    Taskwarrior no longer supports file format 1, originally used between 27
    November 2006 and 31 December 2007.

  We now see:

    Unrecognized Taskwarrior file format or blank line in data.

- Merged t2.t.cpp into t.t.cpp.
2015-10-23 10:13:38 -04:00
Paul Beckingham
799e62051f Test: Removed Date 2015-10-05 09:54:54 -04:00
Paul Beckingham
f97e68f1d6 Build: Ensured 'run_all' is present in the test dir
- Thanks to Gordon Ball.
2015-09-19 12:48:32 -04:00
Paul Beckingham
565232eccd Duration: Obsolete, removed 2015-08-12 11:41:15 -04:00