diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-12-13 21:57:53 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-01-23 21:20:44 +0300 |
commit | fc3fb39c90ab7fe5fccbe3f3bc0eb2645157bb96 (patch) | |
tree | 6c8c1bfb5fe89f7378b92ac066b4ca8ecfd25228 /pgsql/truncation | |
parent | 02367faedb16b6186e8852de47e5b749dc48c2df (diff) |
Switch to build2
Diffstat (limited to 'pgsql/truncation')
-rw-r--r-- | pgsql/truncation/buildfile | 35 | ||||
-rw-r--r-- | pgsql/truncation/driver.cxx | 16 | ||||
-rw-r--r-- | pgsql/truncation/makefile | 107 | ||||
-rw-r--r-- | pgsql/truncation/test.std | 0 | ||||
-rw-r--r-- | pgsql/truncation/testscript | 11 |
5 files changed, 55 insertions, 114 deletions
diff --git a/pgsql/truncation/buildfile b/pgsql/truncation/buildfile new file mode 100644 index 0000000..2f2f3a2 --- /dev/null +++ b/pgsql/truncation/buildfile @@ -0,0 +1,35 @@ +# file : pgsql/truncation/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +assert ($pgsql && !$multi || $build.meta_operation == 'dist') \ +"pgsql should be configured via config.odb_tests.database variable as a single database" + +import libodb = libodb%lib{odb} + +import libs = libodb-pgsql%lib{odb-pgsql} +import libs += lib{common} + +exe{driver}: {hxx cxx}{* -*-odb} {hxx ixx cxx}{test-odb} testscript + +# Introduce the metadata library target to make sure the libodb library is +# resolved for the odb_compile ad hoc rule (see build/root.build for details). +# +libue{test-meta}: $libodb + +<{hxx ixx cxx}{test-odb}>: hxx{test} libue{test-meta} + +exe{driver}: libue{test-meta} $libs + +# Specify the ODB custom options to be used by the odb_compile ad hoc rule +# (see build/root.build for details). +# +odb_options = --table-prefix pgsql_truncation_ \ + --generate-schema \ + --default-database common \ + --generate-query + +cxx.poptions =+ "-I$out_base" "-I$src_base" + +# Testscript's run-time prerequisites. +# +exe{driver}: ../../alias{pgsql-client}: include = adhoc diff --git a/pgsql/truncation/driver.cxx b/pgsql/truncation/driver.cxx index 63135d4..337a26e 100644 --- a/pgsql/truncation/driver.cxx +++ b/pgsql/truncation/driver.cxx @@ -4,18 +4,20 @@ // Test insufficient buffer/truncation handling. // -#include <memory> // std::auto_ptr -#include <cassert> +#include <memory> // std::unique_ptr #include <iostream> #include <odb/pgsql/database.hxx> #include <odb/pgsql/transaction.hxx> -#include <common/common.hxx> +#include <libcommon/common.hxx> #include "test.hxx" #include "test-odb.hxx" +#undef NDEBUG +#include <cassert> + using namespace std; namespace pgsql = odb::pgsql; using namespace pgsql; @@ -33,7 +35,7 @@ main (int argc, char* argv[]) // Test basic operations. // { - auto_ptr<database> db (create_specific_database<database> (argc, argv)); + unique_ptr<database> db (create_specific_database<database> (argc, argv)); // Run persist/load so that the initial bindings are established // (version == 0). @@ -71,7 +73,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object2> o (db->load<object2> (3)); + unique_ptr<object2> o (db->load<object2> (3)); assert (o->str_ == long_str); t.commit (); } @@ -89,7 +91,7 @@ main (int argc, char* argv[]) { transaction t (db->begin ()); - auto_ptr<object2> o (db->load<object2> (3)); + unique_ptr<object2> o (db->load<object2> (3)); assert (o->str_ == longer_str); t.commit (); } @@ -101,7 +103,7 @@ main (int argc, char* argv[]) typedef pgsql::query<object1> query; typedef odb::result<object1> result; - auto_ptr<database> db (create_specific_database<database> (argc, argv)); + unique_ptr<database> db (create_specific_database<database> (argc, argv)); // Run persist/query so that the initial bindings are established // (version == 0). diff --git a/pgsql/truncation/makefile b/pgsql/truncation/makefile deleted file mode 100644 index 9519291..0000000 --- a/pgsql/truncation/makefile +++ /dev/null @@ -1,107 +0,0 @@ -# file : pgsql/truncation/makefile -# license : GNU GPL v2; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make - -cxx_tun := driver.cxx -odb_hdr := test.hxx -genf := $(call odb-gen,$(odb_hdr)) -gen := $(addprefix $(out_base)/,$(genf)) -cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) $(filter %.o,$(gen:.cxx=.o)) -cxx_od := $(cxx_obj:.o=.o.d) - -common.l := $(out_root)/libcommon/common/common.l -common.l.cpp-options := $(out_root)/libcommon/common/common.l.cpp-options - -# Import. -# -$(call import,\ - $(scf_root)/import/odb/stub.make,\ - odb: odb,odb-rules: odb_rules) - -# Build. -# -$(driver): $(cxx_obj) $(common.l) -$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base) -I$(src_base) -$(cxx_obj) $(cxx_od): $(common.l.cpp-options) - -$(gen): $(odb) -$(gen): odb := $(odb) -$(gen) $(dist): export odb_options += --database pgsql --default-database \ -common --generate-schema --generate-query --table-prefix pgsql_truncation_ -$(gen): cpp_options := -I$(src_base) -$(gen): $(common.l.cpp-options) - -$(call include-dep,$(cxx_od),$(cxx_obj),$(gen)) - -# Alias for default target. -# -$(out_base)/: $(driver) - -# Dist -# -$(dist): sources := $(cxx_tun) -$(dist): headers := $(odb_hdr) -$(dist): data_dist := test.std -$(dist): export name := $(subst /,-,$(subst $(src_root)/pgsql/,,$(src_base))) -$(dist): export extra_dist := $(data_dist) \ -$(name)-vc8.vcproj $(name)-vc9.vcproj \ -$(name)-vc10.vcxproj $(name)-vc10.vcxproj.filters \ -$(name)-vc11.vcxproj $(name)-vc11.vcxproj.filters \ -$(name)-vc12.vcxproj $(name)-vc12.vcxproj.filters -$(dist): - $(call dist-data,$(sources) $(headers) $(data_dist)) - $(call meta-automake,../template/Makefile.am) - $(call meta-vc8proj,../template/template-vc8.vcproj,$(name)-vc8.vcproj) - $(call meta-vc9proj,../template/template-vc9.vcproj,$(name)-vc9.vcproj) - $(call meta-vc10proj,../template/template-vc10.vcxproj,$(name)-vc10.vcxproj) - $(call meta-vc11proj,../template/template-vc11.vcxproj,$(name)-vc11.vcxproj) - $(call meta-vc12proj,../template/template-vc12.vcxproj,$(name)-vc12.vcxproj) - -# Test. -# -$(eval $(call test-rule)) - -# Clean. -# -$(clean): \ - $(driver).o.clean \ - $(addsuffix .cxx.clean,$(cxx_obj)) \ - $(addsuffix .cxx.clean,$(cxx_od)) \ - $(addsuffix .hxx.clean,$(filter %.cxx,$(gen))) - $(call message,,rm -f $(out_base)/test.out) - -# Generated .gitignore. -# -ifeq ($(out_base),$(src_base)) -$(driver): | $(out_base)/.gitignore - -$(out_base)/.gitignore: files := driver $(genf) -$(clean): $(out_base)/.gitignore.clean - -$(call include,$(bld_root)/git/gitignore.make) -endif - -# How to. -# -$(call include,$(bld_root)/dist.make) -$(call include,$(bld_root)/meta/vc8proj.make) -$(call include,$(bld_root)/meta/vc9proj.make) -$(call include,$(bld_root)/meta/vc10proj.make) -$(call include,$(bld_root)/meta/vc11proj.make) -$(call include,$(bld_root)/meta/vc12proj.make) -$(call include,$(bld_root)/meta/automake.make) - -$(call include,$(bld_root)/cxx/standard.make) # cxx_standard -ifdef cxx_standard -$(gen): odb_options += --std $(cxx_standard) -$(call include,$(odb_rules)) -endif - -$(call include,$(bld_root)/cxx/cxx-d.make) -$(call include,$(bld_root)/cxx/cxx-o.make) -$(call include,$(bld_root)/cxx/o-e.make) - -# Dependencies. -# -$(call import,$(src_root)/libcommon/makefile) diff --git a/pgsql/truncation/test.std b/pgsql/truncation/test.std deleted file mode 100644 index e69de29..0000000 --- a/pgsql/truncation/test.std +++ /dev/null diff --git a/pgsql/truncation/testscript b/pgsql/truncation/testscript new file mode 100644 index 0000000..c57b723 --- /dev/null +++ b/pgsql/truncation/testscript @@ -0,0 +1,11 @@ +# file : pgsql/truncation/testscript +# license : GNU GPL v2; see accompanying LICENSE file + +.include ../../database-options.testscript +.include ../../pgsql.testscript + ++$create_schema + +: basics +: +$* |