The upgrade of the calorimeters for the High Luminosity LHC (HL-LHC) or for future colliders requires an extensive programme of tests to qualify different detector prototypes with dedicated test beams. A common data-acquisition system (called H4DAQ) was developed for the H4 test beam line of the CERN SPS North Area in 2014, and it has since been adopted by an increasing number of teams involved in the CMS experiment and AIDA groups. Several different calorimeter prototypes and precision timing detectors have used H4DAQ from 2014 to 2017. H4DAQ has proven to be a versatile application, portable to many beam test environments, including the CERN beam lines (EA-T9 at the PS and H2/H4 at the SPS) and the INFN Frascati Beam Test Facility. H4DAQ is fast, simple, modular and can be configured to support different setups. The different functionalities of the DAQ core software are split into three configurable finite state machines: the data readout, run control, and event builder. The distribution of information and data between the various computers is performed using ZEROMQ (0MQ) sockets. Different plugins are available to read different types of hardware, including VME crates with different types of boards, PADE boards, custom front-end boards, and beam instrumentation devices. The raw data are saved as root files, using the CERN C++ root libraries. A graphical user interface (GUI), based on the python gtk libraries, is used to operate the H4DAQ and the integrated data quality monitoring (DQM), written in C++. This GUI allows for fast processing of events for quick feedback to the user. The 0MQ libraries are also available for the National Instruments LabVIEW program. This facilitates communication with existing instrumentation and detector control systems, via commands issued by the H4DAQ GUI. The design, functionality, and operational experience with the H4DAQ system will be described in this talk.