A shortage of HIV testing could undermine global efforts to diagnose and treat people with the infection, warn experts from the World Health Organization.
They looked at responses to annual surveys that the WHO had sent to 127 countries between 2012 and 2014 asking about capacity and usage of blood tests that check HIV status and health.
They found worrying gaps in provision.
They warn that United Nation targets for HIV could be missed as a result.
The targets say that by 2020, 90% of all people living with HIV should know their HIV status, 90% of those diagnosed should receive antiretroviral therapy and 90% of these treated patients should have "durable viral suppression" (a measure of effective treatment).
Laboratory testing is vital to meet and monitor these aims.
But Vincent Habiyambere and his colleagues say in the journal PLoS Medicine that some low and middle-income countries, including African countries where the HIV burden is high, are not yet geared up for the challenge.
The surveys were sent to:
• all 47 countries in the WHO African Region
• 33 countries in the WHO Region of the Americas
• all 21 countries in the WHO Eastern Mediterranean Region
• eight high-burden HIV countries in the WHO European Region
• all 11 countries in the WHO South-East Asia Region
• seven high-burden HIV countries in the WHO Western Pacific Region
Over the three survey years, 55 (43%) countries responded to all three surveys, 35 (28%) to two surveys, 25 (20%) to one survey, and nine (7%) responded to none of the three surveys.
Testing provision did improve over the years, but shortfalls remained in some parts of the world.
Reasons for the gaps in provision included lack of reagents, equipment not being installed or maintained properly and inadequate or absent staff training. In some laboratories, machines were not serviced regularly. In others, machines broke down and were not covered by contracts to be serviced or fixed.
Dr Habiyambere and his team say: "A national laboratory strategic plan to strengthen services must be developed, implemented, and monitored by governments and their national and international partners.
"The focus of the international community, to ensure optimal use of laboratory technologies, should be on those countries where interventions for scaling up access to HIV diagnostic technologies are most needed."
They acknowledge that they did not look at private sector testing and that some countries might rely more heavily on this than others.
In an accompanying editorial, HIV experts Peter Kilmarx and Raiva Simbi say the findings show some programmes may have been "overly focused" on buying equipment without planning for how it would be used and maintained.
In Zimbabwe, for example, only 5.6% of HIV patients on drug treatment in 2015 received regular blood checks to monitor their viral load - far fewer than the goal of 21%.
This was largely down to problems with resource mobilisation and specimen transport as well as equipment procurement, they say.
"Strong leadership, resources, planning, and management are needed to scale up laboratory services," they conclude.