There is already a databases tap tests in pg_rewind, wonder if there is a need for tablespace tap tests in pg_rewind.
Attached is a initial patch from me.
Here is a patch for runing pg_rewind, it is very similar to src/bin/pg_rewind/t/002_databases.pl, but there is no master_psql("CREATE TABLESPACE beforepromotion LOCATION '$tempdir/beforepromotion'"); after create_standby() and before promote_standby(), because pg_rewind will error out :
could not create directory "/Users/sbai/work/postgres/src/bin/pg_rewind/tmp_check/t_006_tablespace_master_local_data/pgdata/pg_tblspc/24576/PG_12_201903063": File exists