Please let me know some hints not the whole solution.
Problem: Let $A ⊂ \mathbb{R}$ be a non-empty open set such that $$ \int_{A}\phi'(x)dx\leq 0, $$ for all $\phi ∈ C_c^1(\mathbb{R})$ with $\phi ≥ 0.$ Prove that $A$ is unbounded.
If $A$ is bounded and of positive measure, we can just select $\phi\in C_c^1(\mathbb{R})$ to be increasing everywhere on $A$.
As an example, for $M$ and $N$ the lower and upper bounds for $A$, let $\phi$ be a symmetric bump function supported on $[M, 2N-M]$, such as $\phi(x) = \exp\left(-\frac{1}{1-\left(\frac{x-N}{N-M}\right)^2}\right)$ on $(M, 2N-M)$ and $0$ elsewhere (which increases from $M$ to $N$ and decreases from $N$ to $2N-M$). Then, $$\int_A \phi'(x)\,\mathrm{d}x > 0$$
If $A$ is a bounded open set, you can write $$A=\cup_{i=0}^J (a_i,b_i)$$ where $J \in \mathbb{N} \cup \{\infty\}$.
Therefore if you $\phi(a_0)=0$, $\phi(b_0)=max\phi$, $\phi$ increasing on $(a_0,b_0)$ and decreasing after $b_0$ you get $$\int_A \phi'(x)=\sum_{n \in \mathbb{N}} \phi(b_n)-\phi(a_n)=\phi(b_0)-\sum_{n\geq 1}\phi(a_n)-\phi(b_n)>0$$