Message ID | 1525376963-79623-37-git-send-email-mst@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
"Michael S. Tsirkin" <mst@redhat.com> wrote: > This way they are easier to find using standard rules. > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Nack. This are _internal_ files, that shouldn't be used anywere elese. Except .... that we need them to write tests. We only have two scopes on qemu: - internal: only for the subsystem we are at in - pubilc: they can be used everywhere So, tests came in a strange class here, because they need internal implementation, but they are not in the proper directory due to the way we do tests. I *think* that using complete paths is the only reasonable way of doing this. Thanks, Juan.
On 05/08/2018 09:25 AM, Juan Quintela wrote: > "Michael S. Tsirkin" <mst@redhat.com> wrote: >> This way they are easier to find using standard rules. >> >> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > > Nack. > > This are _internal_ files, that shouldn't be used anywere elese. > > Except .... that we need them to write tests. We only have two scopes > on qemu: > - internal: only for the subsystem we are at in > - pubilc: they can be used everywhere > > So, tests came in a strange class here, because they need internal > implementation, but they are not in the proper directory due to the way > we do tests. > > I *think* that using complete paths is the only reasonable way of doing > this. I hit the same issue with SD tests. The current scheme is confuse but works fine: tests/test-vmstate.c:30:#include "migration/qemu-file-types.h" tests/test-vmstate.c:32:#include "../migration/qemu-file-channel.h" Michael, what about keeping those includes internal ("only for the subsystem we are at in") and adding complete paths in tests/Makefile.include? Such: tests/test-vmstate.o: QEMU_CFLAGS += -I$(SRC_PATH)/migration
On Tue, May 08, 2018 at 02:25:07PM +0200, Juan Quintela wrote: > "Michael S. Tsirkin" <mst@redhat.com> wrote: > > This way they are easier to find using standard rules. > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > > Nack. > > This are _internal_ files, that shouldn't be used anywere elese. > > Except .... that we need them to write tests. We only have two scopes > on qemu: > - internal: only for the subsystem we are at in > - pubilc: they can be used everywhere > > So, tests came in a strange class here, because they need internal > implementation, but they are not in the proper directory due to the way > we do tests. > I *think* that using complete paths is the only reasonable way of doing > this. > > Thanks, Juan. So how about tests include internal headers in a special way then? #include "../migration/foo.h" works but makes it clear something unusual is going on.
On Fri, May 11, 2018 at 08:23:22PM +0300, Michael S. Tsirkin wrote: > On Tue, May 08, 2018 at 02:25:07PM +0200, Juan Quintela wrote: > > "Michael S. Tsirkin" <mst@redhat.com> wrote: > > > This way they are easier to find using standard rules. > > > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > > > > Nack. > > > > This are _internal_ files, that shouldn't be used anywere elese. > > > > Except .... that we need them to write tests. We only have two scopes > > on qemu: > > - internal: only for the subsystem we are at in > > - pubilc: they can be used everywhere > > > > So, tests came in a strange class here, because they need internal > > implementation, but they are not in the proper directory due to the way > > we do tests. > > I *think* that using complete paths is the only reasonable way of doing > > this. > > > > Thanks, Juan. > > So how about tests include internal headers in a special way then? > > #include "../migration/foo.h" works but makes it clear > something unusual is going on. I might suggest that the idea of having a single directory for all tests is the real problem here. We have structured our source so that each logically separate area of code has its own subdirectory, and then we dump all unit tests in one big directory ! So how about moving unit tests into their respective directories, so then any internal headers they need are just local includes. Leave the global tests/ directory for qtests and iotests, etc which don't need to poke at internal source. Regards, Daniel
diff --git a/include/migration/migration.h b/include/migration/migration.h new file mode 100644 index 0000000..516b7f6 --- /dev/null +++ b/include/migration/migration.h @@ -0,0 +1 @@ +#include_next "../migration/migration.h" diff --git a/include/migration/postcopy-ram.h b/include/migration/postcopy-ram.h new file mode 100644 index 0000000..2ea8237 --- /dev/null +++ b/include/migration/postcopy-ram.h @@ -0,0 +1 @@ +#include_next "../migration/postcopy-ram.h" diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h new file mode 100644 index 0000000..8ea3af1 --- /dev/null +++ b/include/migration/qemu-file.h @@ -0,0 +1 @@ +#include_next "../migration/qemu-file.h"
This way they are easier to find using standard rules. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- include/migration/migration.h | 1 + include/migration/postcopy-ram.h | 1 + include/migration/qemu-file.h | 1 + 3 files changed, 3 insertions(+) create mode 100644 include/migration/migration.h create mode 100644 include/migration/postcopy-ram.h create mode 100644 include/migration/qemu-file.h